[AiOverlayDialog] SetText tool [chromium/src : main]

0 views
Skip to first unread message

Gary Klassen (Gerrit)

unread,
Jun 5, 2026, 10:39:06 PMJun 5
to android-bu...@system.gserviceaccount.com, Ken Buchanan, David Bokan, chromium...@chromium.org, penghuan...@chromium.org, chrome-intell...@chromium.org, cblume...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, bo...@google.com, aleventh...@chromium.org, blink-...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from David Bokan

Gary Klassen added 9 comments

Patchset-level comments
File-level comment, Patchset 19 (Latest):
Gary Klassen . resolved

Thanks for the reviews! This change is muuuuuuch better for it. Look ok?

File chrome/browser/ui/webui/ai_overlay_dialog/ai_overlay_dialog_page_handler.cc
Line 192, Patchset 1 (Parent):
David Bokan . resolved

supernit: undo

Gary Klassen

Done

File chrome/browser/ui/webui/ai_overlay_dialog/tools/tools.cc
Line 304, Patchset 1: } else {
David Bokan . resolved

What is `element_id` representing here? The comment in the mojom says this has to be a numeric ID but we're falling back to alpha identifier below?

Gary Klassen

Done

Line 310, Patchset 1: base::WriteJson(base::Value(selector_expr)).value_or("\"\"");
David Bokan . resolved

Why `WriteJson`? What does this do? Why can't we just put the selector directly in the string below?

Gary Klassen

Done

Line 323, Patchset 1: " const plain = raw.replace(/<[^>]*>/g, '');\n",
David Bokan . resolved

A large block of JS is very hard to parse what's going on for a reader...if we keep this, we should at least add some comments to make it more digestable.

Gary Klassen

Done

Line 338, Patchset 1: " el.dispatchEvent(new ClipboardEvent('paste', {\n",
David Bokan . resolved

Are we...trying to paste the data _in addition to_ using a property setter / innerHTML above? This isn't in an `else` block...

Gary Klassen

Done

Line 354, Patchset 1: rfh->ExecuteJavaScriptInIsolatedWorld(
David Bokan . resolved

This is suspect...injecting JS into the page for a browser feature is very unusual. On a practical level I suspect this causes a bunch of extra memory and device usage to spin up the JS machinery for a new world. It also introduces the possibility of colliding with page JS and is generally opaque about what we're doing.

Dictation will be adding some machinery here that could help. In the mean time I'd suggest re-using or taking an approach similar to actor [TypeTool](https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/actor.mojom;l=71;drc=25b5ecdbad3b09f037021101fa78c28fa258ca5f)

Gary Klassen

Done

File third_party/blink/renderer/modules/content_extraction/ai_page_content_agent.cc
Line 2495, Patchset 1: element->setAttribute(AtomicString("data-element-id"),
David Bokan . resolved

We shouldn't mutate an author's DOM for a builtin browser feature. APC already gives you a DOMNodeId which is stable. We need a object in the renderer for AiOverlay to take that DOMNodeId+string, convert back from DOMNodeId to DOM element and send it KeyEvents/DataTransfer like GiC

Gary Klassen

Done

Line 2495, Patchset 1: element->setAttribute(AtomicString("data-element-id"),
David Bokan . resolved

We shouldn't mutate an author's DOM for a builtin browser feature. APC already gives you a DOMNodeId which is stable. We need a object in the renderer for AiOverlay to take that DOMNodeId+string, convert back from DOMNodeId to DOM element and send it KeyEvents/DataTransfer like GiC

Gary Klassen

Done

Open in Gerrit

Related details

Attention is currently required from:
  • David Bokan
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9016cc9248a6ae8e4a7ccc5f5f722a2f18bfad47
Gerrit-Change-Number: 7903623
Gerrit-PatchSet: 19
Gerrit-Owner: Gary Klassen <gkla...@chromium.org>
Gerrit-Reviewer: David Bokan <bo...@chromium.org>
Gerrit-Reviewer: Ken Buchanan <ke...@chromium.org>
Gerrit-Attention: David Bokan <bo...@chromium.org>
Gerrit-Comment-Date: Sat, 06 Jun 2026 02:38:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: David Bokan <bo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

David Bokan (Gerrit)

unread,
Jun 8, 2026, 7:27:51 AMJun 8
to Gary Klassen, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Ken Buchanan, chromium...@chromium.org, penghuan...@chromium.org, chrome-intell...@chromium.org, cblume...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, bo...@google.com, aleventh...@chromium.org, blink-...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Gary Klassen

David Bokan voted and added 6 comments

Votes added by David Bokan

Code-Review+1

6 comments

Patchset-level comments
David Bokan . resolved

few minor comments but lgtm!

File chrome/browser/ui/webui/ai_overlay_dialog/tools/tools.h
Line 102, Patchset 19 (Latest): base::WeakPtrFactory<AiOverlayTools> weak_ptr_factory_{this};
David Bokan . unresolved

Unused

File chrome/browser/ui/webui/ai_overlay_dialog/tools/tools.cc
Line 28, Patchset 19 (Latest):#include "chrome/common/chrome_isolated_world_ids.h"
David Bokan . unresolved

This and json_writer are unused now

Line 326, Patchset 19 (Latest): std::move(callback).Run(base::unexpected("Invalid numeric element id"));
David Bokan . unresolved

Any reason we cant define element_id as an int in the mojom API? (i.e. client has to convert the markdown extracted value to int)

Line 345, Patchset 19 (Latest): if (res && res->code == actor::mojom::ActionResultCode::kOk) {
David Bokan . unresolved

This should be guaranteed non-null, you can omit or CHECK this

File chrome/browser/ui/webui/ai_overlay_dialog/tools/tools_browsertest.cc
Line 376, Patchset 19 (Latest): GURL("data:text/html,<html><body><input id='test_input' "
David Bokan . unresolved

nit: omit the html and body tags in tests to avoid clutter and avoid the trailing '/' in <input>'s closing tag

Open in Gerrit

Related details

Attention is currently required from:
  • Gary Klassen
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I9016cc9248a6ae8e4a7ccc5f5f722a2f18bfad47
    Gerrit-Change-Number: 7903623
    Gerrit-PatchSet: 19
    Gerrit-Owner: Gary Klassen <gkla...@chromium.org>
    Gerrit-Reviewer: David Bokan <bo...@chromium.org>
    Gerrit-Reviewer: Gary Klassen <gkla...@chromium.org>
    Gerrit-Reviewer: Ken Buchanan <ke...@chromium.org>
    Gerrit-Attention: Gary Klassen <gkla...@chromium.org>
    Gerrit-Comment-Date: Mon, 08 Jun 2026 11:27:38 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Gary Klassen (Gerrit)

    unread,
    Jul 25, 2026, 8:45:09 PMĀ (21 hours ago)Ā Jul 25
    to David Bokan, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Ken Buchanan, chromium...@chromium.org, penghuan...@chromium.org, chrome-intell...@chromium.org, cblume...@chromium.org, devtools...@chromium.org, chrome-intelligence-te...@google.com, bo...@google.com, aleventh...@chromium.org, blink-...@chromium.org, mfoltz+wa...@chromium.org

    Gary Klassen abandoned this change.

    View Change

    Abandoned

    Gary Klassen abandoned this change

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: abandon
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages