[AF] Add and implement ObserveFieldVisibility in AutofillAgent [chromium/src : main]

0 views
Skip to first unread message

Fernando Ramirez (Gerrit)

unread,
Jun 22, 2026, 3:13:01 AM (7 days ago) Jun 22
to Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Christoph Schwering, Nasko Oskov and Stefan Zager

Fernando Ramirez added 1 comment

Patchset-level comments
File-level comment, Patchset 13:
Nasko Oskov . unresolved

Just updating that Fernando and I had an offline chat about the mojo structure, so I expect a new version of the CL to be uploaded when he has had a chance to update it.

Fernando Ramirez

Hi Nasko, could you PTAL at the updated implementation? Instead of using an unbounded callback I use a `PendingRemote`.

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
  • Nasko Oskov
  • Stefan Zager
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
Gerrit-Change-Number: 7870348
Gerrit-PatchSet: 14
Gerrit-Owner: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
Gerrit-Reviewer: Olivia Saul <os...@google.com>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: gwsq
Gerrit-Attention: Nasko Oskov <na...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Mon, 22 Jun 2026 07:12:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Christoph Schwering (Gerrit)

unread,
Jun 22, 2026, 2:58:04 PM (7 days ago) Jun 22
to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Fernando Ramirez, Nasko Oskov and Stefan Zager

Christoph Schwering added 1 comment

File components/autofill/content/common/mojom/autofill_agent.mojom
Line 140, Patchset 14 (Latest): // Starts observing the visibility of the field identified by `field_id`.
// The `observer` will be notified when the field becomes visible (e.g.,
// meets the 800ms visibility condition).
ObserveFieldVisibility(FieldRendererId field_id,
pending_remote<AutofillVisibilityObserver> observer);
Christoph Schwering . unresolved

Could you document why we use `pending_remote`?

IIUC the differences of `pending_remote` compared to a response callback are that `pending_remote`

  • supports multiple methods in the interface (obviously)
  • supports any number of method calls (whereas a response callback must be called exactly once)
  • supports cancellation by the browser process
  • `pending_remote` needs more boilerplate code

We don't use the first and third though, and we actually do guarantee to call the method exactly once, don't we? Is the motivation for the `pending_remote` to defensively handle the case where (due to a bug) AutofillAgent does *not* call the callback? Or am I missing the real point?

Open in Gerrit

Related details

Attention is currently required from:
  • Fernando Ramirez
  • Nasko Oskov
  • Stefan Zager
Gerrit-Attention: Fernando Ramirez <fe...@google.com>
Gerrit-Comment-Date: Mon, 22 Jun 2026 18:57:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Nasko Oskov (Gerrit)

unread,
Jun 22, 2026, 7:46:41 PM (7 days ago) Jun 22
to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Fernando Ramirez and Stefan Zager

Nasko Oskov added 2 comments

Patchset-level comments
File-level comment, Patchset 14 (Latest):
Nasko Oskov . resolved

The shape of the IPC surface looks good. Thanks for working through this. I am happy to proceed this way, but won't +1 until the rest of owners are happy and we are sure we are proceeding with this approach.

File components/autofill/content/common/mojom/autofill_agent.mojom
Line 140, Patchset 14 (Latest): // Starts observing the visibility of the field identified by `field_id`.
// The `observer` will be notified when the field becomes visible (e.g.,
// meets the 800ms visibility condition).
ObserveFieldVisibility(FieldRendererId field_id,
pending_remote<AutofillVisibilityObserver> observer);
Christoph Schwering . unresolved

Could you document why we use `pending_remote`?

IIUC the differences of `pending_remote` compared to a response callback are that `pending_remote`

  • supports multiple methods in the interface (obviously)
  • supports any number of method calls (whereas a response callback must be called exactly once)
  • supports cancellation by the browser process
  • `pending_remote` needs more boilerplate code

We don't use the first and third though, and we actually do guarantee to call the method exactly once, don't we? Is the motivation for the `pending_remote` to defensively handle the case where (due to a bug) AutofillAgent does *not* call the callback? Or am I missing the real point?

Nasko Oskov

Yes, the goal here is to avoid having hanging callbacks across processes.

Open in Gerrit

Related details

Attention is currently required from:
  • Fernando Ramirez
  • Stefan Zager
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Attention: Fernando Ramirez <fe...@google.com>
Gerrit-Comment-Date: Mon, 22 Jun 2026 23:46:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fernando Ramirez (Gerrit)

unread,
Jun 22, 2026, 8:22:07 PM (7 days ago) Jun 22
to Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Christoph Schwering, Nasko Oskov and Stefan Zager

Fernando Ramirez added 5 comments

Patchset-level comments
File-level comment, Patchset 13:
Nasko Oskov . resolved

Just updating that Fernando and I had an offline chat about the mojo structure, so I expect a new version of the CL to be uploaded when he has had a chance to update it.

Fernando Ramirez

Hi Nasko, could you PTAL at the updated implementation? Instead of using an unbounded callback I use a `PendingRemote`.

File components/autofill/content/common/mojom/autofill_agent.mojom
Line 137, Patchset 10: GetIntersectionObserverInfo(FieldRendererId field_id)
Stefan Zager . resolved

FYI for the mojo reviewer: this message seems a bit unusual in that it has a response, but by design the response may be delayed arbitrarily long. It may not even fire until page unload. At a glance, this seems different from other examples of mojo messages with a response:

https://source.chromium.org/search?q=%22%3D%3E%22%20f:.*%5C.mojom$&sq=

Fernando Ramirez

@na...@chromium.org, hopefully my explanation of why the response may be delayed is made clear in https://chromium-review.git.corp.google.com/c/chromium/src/+/7870348/comment/3570d57e_c3b205e4/

Fernando Ramirez

I have updated my implementation. This comment is no longer relevant.

Line 140, Patchset 14: // Starts observing the visibility of the field identified by `field_id`.

// The `observer` will be notified when the field becomes visible (e.g.,
// meets the 800ms visibility condition).
ObserveFieldVisibility(FieldRendererId field_id,
pending_remote<AutofillVisibilityObserver> observer);
Christoph Schwering . unresolved

Could you document why we use `pending_remote`?

IIUC the differences of `pending_remote` compared to a response callback are that `pending_remote`

  • supports multiple methods in the interface (obviously)
  • supports any number of method calls (whereas a response callback must be called exactly once)
  • supports cancellation by the browser process
  • `pending_remote` needs more boilerplate code

We don't use the first and third though, and we actually do guarantee to call the method exactly once, don't we? Is the motivation for the `pending_remote` to defensively handle the case where (due to a bug) AutofillAgent does *not* call the callback? Or am I missing the real point?

Nasko Oskov

Yes, the goal here is to avoid having hanging callbacks across processes.

Fernando Ramirez

and we actually do guarantee to call the method exactly once, don't we?

Correct, this is called at most once (exactly once if the field becomes visible, and zero times if it does not). As opposed to the response callback, we don't have to call it with a fallback value, like `false`, if the user never scrolls down or closes the tab.

I added a code comment for why we use a `pending_remote` too.

Line 144, Patchset 15 (Latest): // Note: We use a `pending_remote<AutofillVisibilityObserver>` instead of a
// standard Mojo response callback (e.g., `=> (bool is_visible)`) because the
// visibility condition depends on user interaction (scrolling) and may be
// delayed indefinitely. Since standard Mojo response callbacks are expected
// to return promptly, we avoid using an unbounded callback here in favor of a
// dedicated Mojo observer interface.
Fernando Ramirez . unresolved

Just double checking if this all looks good to you based on our offline discussion @na...@chromium.org

File components/autofill/content/renderer/autofill_agent.cc
Line 1698, Patchset 7: base::OnceCallback<void(bool)> callback) {
Christoph Schwering . resolved

Like in the previous version, this callback must be called. IIUC this CL doesn't guarantee it. Am I missing something?

Fernando Ramirez

No, you are correct the callback is never called when the credit card number field is never fully visible for at least 800ms. This can happen because:

  • The user never scrolls down to the credit card number field
  • The user scrolls past the element too quickly
  • The user closes the tab

Could we use `ScopedClosureRunner` similar to the original CL? Could this ensure the callback is called with `false` in these cases?

Olivia Saul

Drive-by: How come this callback must be called? Is there a contract or something that has to be fulfilled because it's in AutofillAgent-land? In my design I just sort of figured it was okay if the user never scrolled down and the callback was never called, similar to how we use callbacks for UI bubbles ("here's a callback IF the user accepts the dialog").

Christoph Schwering

How come this callback must be called?

It's a Mojo requirement. I can't find it in the documentation right now, but the generated mojo code is includes this
```
class AutofillAgent_TriggerFormExtractionWithResponse_ProxyToResponder : public ::mojo::internal::ProxyToResponder {
public:
~AutofillAgent_TriggerFormExtractionWithResponse_ProxyToResponder() {
#if DCHECK_IS_ON()
if (responder_) {
responder_->IsConnectedAsync(base::BindOnce(&OnIsConnectedComplete));
}
#endif
}
 private:
#if DCHECK_IS_ON()
static void OnIsConnectedComplete(bool connected) {
DCHECK(!connected)
<< "AutofillAgent::TriggerFormExtractionWithResponseCallback was destroyed without "
<< "first either being run or its corresponding binding being closed. "
<< "It is an error to drop response callbacks which still correspond "
<< "to an open interface pipe.";
}
#endif
};
```

Could we use ScopedClosureRunner similar to the original CL?

We can't use it directly. In the original CL, we used the ScopedClosureRunner to delete an object, which owned the response callback and whose destructor called that response callback (IIRC). That pattern would work here, too, I think.

Alternatively, we can use base::SplitOnceCallback to in AutofillAgent. That'd roughly look like this:
```
auto [cb1, cb2] = base::SplitCallback(std::move(callback));
element.GetDocument().MonitorFormFieldVisibility(element, std::move(cb1));
base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask(
FROM_HERE, base::BindOnce(std::move(cb2), false), base::Seconds(2));
// Or a timer, but IIUC calling `cb2` would be safe:
// some_timer_.Start(FROM_HERE, base::Seconds(1),
// base::BindOnce(std::move(cb2), false));
```
Stefan Zager

I'm no expert, but I find it unusual to use a mojo message with a responder in this way, when the response may be delayed indefinitely. In other examples I have seen the response is typically sent promptly. Would it make sense to split this into two distinct mojo messages, `MonitorVisibiltiy` and `ReportVisible`?

Fernando Ramirez

I incorporated the use of `ScopedClosureRunner` for `MonitorVisibiltiy`. This should follow the same approach as the original CL (crrev.com/c/7814161). This ensures the callback is always called, is my understanding here correct?

Christoph Schwering

Yes, I think this is correct.

Would it make sense to split this into two distinct mojo messages, `MonitorVisibiltiy` and `ReportVisible`?

I agree this feels a bit weird. I'm not aware of guidelines for this specific case. I think the general recommendation is to use response callbacks. Let's check with the Mojo reviewer.

Nasko Oskov

IPC reviewers usually look at the security implications of the design, not as much on the functional side.

That said, most interfaces do indeed follow the pattern of having API respond as soon as possible while any future changes use observers.

I'm not versed enough in what this feature is trying to accomplish to be able to give more concrete examples of how to proceed. I would suggest looking at other interfaces for inspiration.

Fernando Ramirez

while any future changes use observers.

So we should be able to proceed with our approach since we use an observer?

I'm not versed enough in what this feature is trying to accomplish to be able to give more concrete examples of how to proceed.

We want to be able show an "Autofill payment" chip on the omnibox as an alternative entry point for payments, but only if the credit card number field is actively visible to the user.

Unlike existing methods like `CheckViewAreaVisible`, which perform immediate checks, `GetIntersectionObserverInfo` is a monitoring request. It uses an `IntersectionObserver` to ensure the field has been visible for at least 800ms.

Because this mojo callback response depends on a user scrolling and may never be met, we use `ScopedClosureRunner` to guarantee that the mojo callback is eventually executed with `false` upon destruction, satisfying the requirement that response callbacks must be invoked.


> I would suggest looking at other interfaces for inspiration.

I couldn't find examples that use response callbacks in `autofill_agent.mojom`. I checked in both `autofill_agent.cc` and `password_autofill_agent.cc`.

Fernando Ramirez

Updated my implementation. This comment thread is no longer relevant.

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
  • Nasko Oskov
  • Stefan Zager
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
Gerrit-Change-Number: 7870348
Gerrit-PatchSet: 15
Gerrit-Owner: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
Gerrit-Reviewer: Olivia Saul <os...@google.com>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: gwsq
Gerrit-Attention: Nasko Oskov <na...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 00:21:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
Comment-In-Reply-To: Fernando Ramirez <fe...@google.com>
Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
Comment-In-Reply-To: Olivia Saul <os...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Christoph Schwering (Gerrit)

unread,
Jun 23, 2026, 4:24:02 AM (6 days ago) Jun 23
to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Fernando Ramirez, Nasko Oskov and Stefan Zager

Christoph Schwering added 3 comments

File components/autofill/content/common/mojom/autofill_agent.mojom
Line 140, Patchset 14: // Starts observing the visibility of the field identified by `field_id`.
// The `observer` will be notified when the field becomes visible (e.g.,
// meets the 800ms visibility condition).
ObserveFieldVisibility(FieldRendererId field_id,
pending_remote<AutofillVisibilityObserver> observer);
Christoph Schwering . unresolved

Could you document why we use `pending_remote`?

IIUC the differences of `pending_remote` compared to a response callback are that `pending_remote`

  • supports multiple methods in the interface (obviously)
  • supports any number of method calls (whereas a response callback must be called exactly once)
  • supports cancellation by the browser process
  • `pending_remote` needs more boilerplate code

We don't use the first and third though, and we actually do guarantee to call the method exactly once, don't we? Is the motivation for the `pending_remote` to defensively handle the case where (due to a bug) AutofillAgent does *not* call the callback? Or am I missing the real point?

Nasko Oskov

Yes, the goal here is to avoid having hanging callbacks across processes.

Fernando Ramirez

and we actually do guarantee to call the method exactly once, don't we?

Correct, this is called at most once (exactly once if the field becomes visible, and zero times if it does not). As opposed to the response callback, we don't have to call it with a fallback value, like `false`, if the user never scrolls down or closes the tab.

I added a code comment for why we use a `pending_remote` too.

Christoph Schwering

With the `pending_remote`, a second `ObserveFieldVisibility()` call cancels the first one's subscription without explicitly informing the first one about it. I suppose the caller can use `set_disconnect_handler()` and/or with a timeout to address that? (Could you document that?)

An alternative with less boilerplate code may be a timer in `AutofillAgent` that destroys `form_element_intersection_observer_` after 5 seconds or so. (The timeout could be a parameter of `ObserveFieldVisibility()`.) Are there reasons why the `pending_remote` is preferable?

Line 147, Patchset 15 (Latest): // delayed indefinitely. Since standard Mojo response callbacks are expected

// to return promptly, we avoid using an unbounded callback here in favor of a
Christoph Schwering . unresolved

What does "promptly" mean exactly? I guess it's not "synchronously".

I assume issue is that with the response callback, it is called at the latest when `~AutofillAgent()` destroys `form_element_intersection_observer_`? AFAIK that's technically not an issue. Or is it?

Line 148, Patchset 15 (Latest): // to return promptly, we avoid using an unbounded callback here in favor of a
Christoph Schwering . unresolved

What's an unbounded callback?

Do you mean a dropped callback (= the callback is never called)? `WebElement::MonitorVisibility()` does guarantee to call the callback -- even if it may be very late (when we destroy `form_element_intersection_observer_`).

Open in Gerrit

Related details

Attention is currently required from:
  • Fernando Ramirez
  • Nasko Oskov
  • Stefan Zager
Gerrit-Attention: Fernando Ramirez <fe...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 08:23:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Fernando Ramirez (Gerrit)

unread,
Jun 23, 2026, 5:31:08 PM (6 days ago) Jun 23
to Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Christoph Schwering, Nasko Oskov and Stefan Zager

Fernando Ramirez added 3 comments

File components/autofill/content/common/mojom/autofill_agent.mojom
Line 140, Patchset 14: // Starts observing the visibility of the field identified by `field_id`.
// The `observer` will be notified when the field becomes visible (e.g.,
// meets the 800ms visibility condition).
ObserveFieldVisibility(FieldRendererId field_id,
pending_remote<AutofillVisibilityObserver> observer);
Christoph Schwering . unresolved

Could you document why we use `pending_remote`?

IIUC the differences of `pending_remote` compared to a response callback are that `pending_remote`

  • supports multiple methods in the interface (obviously)
  • supports any number of method calls (whereas a response callback must be called exactly once)
  • supports cancellation by the browser process
  • `pending_remote` needs more boilerplate code

We don't use the first and third though, and we actually do guarantee to call the method exactly once, don't we? Is the motivation for the `pending_remote` to defensively handle the case where (due to a bug) AutofillAgent does *not* call the callback? Or am I missing the real point?

Nasko Oskov

Yes, the goal here is to avoid having hanging callbacks across processes.

Fernando Ramirez

and we actually do guarantee to call the method exactly once, don't we?

Correct, this is called at most once (exactly once if the field becomes visible, and zero times if it does not). As opposed to the response callback, we don't have to call it with a fallback value, like `false`, if the user never scrolls down or closes the tab.

I added a code comment for why we use a `pending_remote` too.

Christoph Schwering

With the `pending_remote`, a second `ObserveFieldVisibility()` call cancels the first one's subscription without explicitly informing the first one about it. I suppose the caller can use `set_disconnect_handler()` and/or with a timeout to address that? (Could you document that?)

An alternative with less boilerplate code may be a timer in `AutofillAgent` that destroys `form_element_intersection_observer_` after 5 seconds or so. (The timeout could be a parameter of `ObserveFieldVisibility()`.) Are there reasons why the `pending_remote` is preferable?

Fernando Ramirez

With the pending_remote, a second ObserveFieldVisibility() call cancels the first one's subscription without explicitly informing the first one about it. I suppose the caller can use set_disconnect_handler() and/or with a timeout to address that? (Could you document that?)

Correct, but for the omnibox project we wouldn't ever call a second `ObserveFieldVisibility()` because of this check: https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/core/browser/ui/payments/omnibox_autofill_delegate.cc;l=123-126;drc=f068323b695d2ce5b559a6cb375a84f82fea51a4.

Still, I documented that the caller can use `set_disconnect_handler()`.

Are there reasons why the pending_remote is preferable?

@na...@chromium.org probably has a better answer to this.

Line 147, Patchset 15: // delayed indefinitely. Since standard Mojo response callbacks are expected

// to return promptly, we avoid using an unbounded callback here in favor of a
Christoph Schwering . unresolved

What does "promptly" mean exactly? I guess it's not "synchronously".

I assume issue is that with the response callback, it is called at the latest when `~AutofillAgent()` destroys `form_element_intersection_observer_`? AFAIK that's technically not an issue. Or is it?

Fernando Ramirez

From my understanding, you're right, it's technically not an issue.

But @na...@chromium.org recommends using a remote rather than an unbounded callback, even if the callback would eventually return when `form_element_intersection_observer_` is destroyed.

Line 148, Patchset 15: // to return promptly, we avoid using an unbounded callback here in favor of a
Christoph Schwering . unresolved

What's an unbounded callback?

Do you mean a dropped callback (= the callback is never called)? `WebElement::MonitorVisibility()` does guarantee to call the callback -- even if it may be very late (when we destroy `form_element_intersection_observer_`).

Fernando Ramirez

What's an unbounded callback?

A callback that can be executed at a completely arbitrary time in the future.

WebElement::MonitorVisibility() does guarantee to call the callback -- even if it may be very late (when we destroy form_element_intersection_observer_).

@na...@chromium.org mentioned to me that this is not usually how we design features, callbacks should return relatively quickly.

Open in Gerrit

Related details

Attention is currently required from:
  • Christoph Schwering
  • Nasko Oskov
  • Stefan Zager
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • 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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
Gerrit-Change-Number: 7870348
Gerrit-PatchSet: 16
Gerrit-Owner: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
Gerrit-Reviewer: Olivia Saul <os...@google.com>
Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
Gerrit-CC: gwsq
Gerrit-Attention: Nasko Oskov <na...@chromium.org>
Gerrit-Attention: Stefan Zager <sza...@chromium.org>
Gerrit-Attention: Christoph Schwering <schw...@google.com>
Gerrit-Comment-Date: Tue, 23 Jun 2026 21:30:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
Comment-In-Reply-To: Fernando Ramirez <fe...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Christoph Schwering (Gerrit)

unread,
Jun 24, 2026, 7:29:03 PM (5 days ago) Jun 24
to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
Attention needed from Fernando Ramirez, Nasko Oskov and Stefan Zager

Christoph Schwering voted and added 3 comments

Votes added by Christoph Schwering

Code-Review+1

3 comments

Patchset-level comments
File-level comment, Patchset 16 (Latest):
Christoph Schwering . resolved

LGTM, thanks for the perseverance, Fernando :)

File components/autofill/content/common/mojom/autofill_agent.mojom
Christoph Schwering

for the omnibox project we wouldn't ever call a second `ObserveFieldVisibility()`

My point is that *another* caller of ObserveFieldVisibility() would implicitly cancel OmniboxAutofillDelegate's observation without OmniboxAutofillDelegate learning about this, which would be difficult to debug. So OmniboxAutofillDelegate may want to set a set_disconnect_handler() (but that's for a future CL, of course).

Line 148, Patchset 15: // to return promptly, we avoid using an unbounded callback here in favor of a
Christoph Schwering . unresolved

What's an unbounded callback?

Do you mean a dropped callback (= the callback is never called)? `WebElement::MonitorVisibility()` does guarantee to call the callback -- even if it may be very late (when we destroy `form_element_intersection_observer_`).

Fernando Ramirez

What's an unbounded callback?

A callback that can be executed at a completely arbitrary time in the future.

WebElement::MonitorVisibility() does guarantee to call the callback -- even if it may be very late (when we destroy form_element_intersection_observer_).

@na...@chromium.org mentioned to me that this is not usually how we design features, callbacks should return relatively quickly.

Christoph Schwering

What's an unbounded callback?

A callback that can be executed at a completely arbitrary time in the future.

I think I haven't seen the expression "unbounded callback" in Chromium before. "Unbound" and "callback" sounds to me like it's referring unbound parameters.

I suppose just "callback" or "response callback" would be clearer.

Open in Gerrit

Related details

Attention is currently required from:
  • Fernando Ramirez
  • Nasko Oskov
  • Stefan Zager
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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
    Gerrit-Change-Number: 7870348
    Gerrit-PatchSet: 16
    Gerrit-Owner: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
    Gerrit-Reviewer: Olivia Saul <os...@google.com>
    Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
    Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Nasko Oskov <na...@chromium.org>
    Gerrit-Attention: Stefan Zager <sza...@chromium.org>
    Gerrit-Attention: Fernando Ramirez <fe...@google.com>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 23:28:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fernando Ramirez (Gerrit)

    unread,
    Jun 24, 2026, 7:56:09 PM (5 days ago) Jun 24
    to Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Nasko Oskov and Stefan Zager

    Fernando Ramirez added 3 comments

    Patchset-level comments
    Christoph Schwering . resolved

    LGTM, thanks for the perseverance, Fernando :)

    Fernando Ramirez

    No problem, and thank you for the bearing with my throughout the review process! This is my first time working with renderer related code so all of this is pretty new to me 😄

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 140, Patchset 14: // Starts observing the visibility of the field identified by `field_id`.
    // The `observer` will be notified when the field becomes visible (e.g.,
    // meets the 800ms visibility condition).
    ObserveFieldVisibility(FieldRendererId field_id,
    pending_remote<AutofillVisibilityObserver> observer);
    Christoph Schwering . resolved
    Fernando Ramirez

    I see what you're saying now. Sounds good, I'll handle this in a separate CL.

    Line 148, Patchset 15: // to return promptly, we avoid using an unbounded callback here in favor of a
    Christoph Schwering . resolved

    What's an unbounded callback?

    Do you mean a dropped callback (= the callback is never called)? `WebElement::MonitorVisibility()` does guarantee to call the callback -- even if it may be very late (when we destroy `form_element_intersection_observer_`).

    Fernando Ramirez

    What's an unbounded callback?

    A callback that can be executed at a completely arbitrary time in the future.

    WebElement::MonitorVisibility() does guarantee to call the callback -- even if it may be very late (when we destroy form_element_intersection_observer_).

    @na...@chromium.org mentioned to me that this is not usually how we design features, callbacks should return relatively quickly.

    Christoph Schwering

    What's an unbounded callback?

    A callback that can be executed at a completely arbitrary time in the future.

    I think I haven't seen the expression "unbounded callback" in Chromium before. "Unbound" and "callback" sounds to me like it's referring unbound parameters.

    I suppose just "callback" or "response callback" would be clearer.

    Fernando Ramirez

    Ah I was using terminology used by @na...@chromium.org in our chat as that's what he referred to. Maybe it's not a common expression.

    I've updated the comment to use "response callback" rather than "unbound callback".

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nasko Oskov
    • Stefan Zager
    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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
    Gerrit-Change-Number: 7870348
    Gerrit-PatchSet: 17
    Gerrit-Owner: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
    Gerrit-Reviewer: Olivia Saul <os...@google.com>
    Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
    Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
    Gerrit-CC: gwsq
    Gerrit-Attention: Nasko Oskov <na...@chromium.org>
    Gerrit-Attention: Stefan Zager <sza...@chromium.org>
    Gerrit-Comment-Date: Wed, 24 Jun 2026 23:55:34 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nasko Oskov (Gerrit)

    unread,
    Jun 24, 2026, 8:15:10 PM (5 days ago) Jun 24
    to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez and Stefan Zager

    Nasko Oskov added 1 comment

    File components/autofill/core/browser/ui/payments/omnibox_autofill_delegate.h
    Line 65, Patchset 17 (Latest): void OnFieldBecameVisible();
    Nasko Oskov . unresolved

    Shouldn't this be `override`? Also, it comes from the mojo interface, but this class hasn't added inheritance from the mojo interface. I'm not sure I follow how this works as I also don't see what code calls ObserveFieldVisibility.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fernando Ramirez
    • Stefan Zager
    Gerrit-Attention: Stefan Zager <sza...@chromium.org>
    Gerrit-Attention: Fernando Ramirez <fe...@google.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 00:14:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fernando Ramirez (Gerrit)

    unread,
    Jun 24, 2026, 8:41:00 PM (5 days ago) Jun 24
    to Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Nasko Oskov, Stefan Zager and Yishui Liu

    Fernando Ramirez added 1 comment

    File components/autofill/core/browser/ui/payments/omnibox_autofill_delegate.h
    Line 65, Patchset 17 (Latest): void OnFieldBecameVisible();
    Nasko Oskov . unresolved

    Shouldn't this be `override`? Also, it comes from the mojo interface, but this class hasn't added inheritance from the mojo interface. I'm not sure I follow how this works as I also don't see what code calls ObserveFieldVisibility.

    Fernando Ramirez

    `OnFieldBecameVisible` is not an override because `OmniboxAutofillDelegate` is a core browser class that doesn't implement mojo interfaces directly.

    Instead, this is handled in `ContentAutofillDriver`, which translates the incoming mojo notification back to this C++ callback.

    This call to the driver is implemented by @yis...@google.com in crrev.com/c/7944884 like this:

    ```
    manager.driver().ObserveFieldVisibility(
    /*field_id=*/trigger_field_global_id_,
    /*callback=*/
    base::BindOnce(&OmniboxAutofillDelegate::OnFieldBecameVisible,
    weak_ptr_factory_.GetWeakPtr()));
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Nasko Oskov
    • Stefan Zager
    • Yishui Liu
    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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
    Gerrit-Change-Number: 7870348
    Gerrit-PatchSet: 17
    Gerrit-Owner: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
    Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
    Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
    Gerrit-Reviewer: Olivia Saul <os...@google.com>
    Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
    Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
    Gerrit-CC: Yishui Liu <yis...@google.com>
    Gerrit-Attention: Nasko Oskov <na...@chromium.org>
    Gerrit-Attention: Stefan Zager <sza...@chromium.org>
    Gerrit-Attention: Yishui Liu <yis...@google.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 00:40:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stefan Zager (Gerrit)

    unread,
    Jun 25, 2026, 3:54:55 PM (4 days ago) Jun 25
    to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez, Nasko Oskov and Yishui Liu

    Stefan Zager added 7 comments

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 11, Patchset 17 (Latest):interface AutofillVisibilityObserver {
    Stefan Zager . unresolved

    There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

    File third_party/blink/public/web/web_element.h
    Line 233, Patchset 17 (Latest): base::OnceCallback<void(bool)> callback) const;
    Stefan Zager . unresolved

    I don't think `const` is correct here.

    Line 45, Patchset 17 (Latest):class TimeDelta;
    Stefan Zager . unresolved

    This is a bit weird -- `MonitorVisibility` takes a concrete (non-pointer non-reference) `TimeDelta` argument, so this header must be able to access the class definition for `TimeDelta`. Seems like this should either be an `#include` (following the rule of "Include What You Use"), or this advance declaration should be superfluous.

    File third_party/blink/renderer/core/exported/web_element.cc
    Line 581, Patchset 17 (Latest): element->GetDocument().GetTaskRunner(TaskType::kUserInteraction),
    Stefan Zager . unresolved

    This should be the default task runner; this task shouldn't compete with input events.

    Line 593, Patchset 17 (Latest): observer_ = IntersectionObserver::Create(
    Stefan Zager . unresolved

    This overload of `Create` is meant only to support construction from javascript. For blink-internal usage like this, you should use:

    https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/intersection_observer/intersection_observer.cc;drc=5650b3485eaa8443ee812a44056a1b88b4ee0ce1;l=305

    This implies that `VisibilityObserver` need not inherit from `IntersectionObserverDelegate`. This probable makes some of the new `#include`'s unnecessary.

    Line 629, Patchset 17 (Latest): DeliverResult(false);
    Stefan Zager . unresolved

    This doesn't seem possible.

    Line 656, Patchset 17 (Latest): visibility_timer_.Stop();
    Stefan Zager . unresolved

    Should this be moved outside the `if` clause?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fernando Ramirez
    • Nasko Oskov
    • Yishui Liu
    Gerrit-Attention: Yishui Liu <yis...@google.com>
    Gerrit-Attention: Fernando Ramirez <fe...@google.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 19:54:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Nasko Oskov (Gerrit)

    unread,
    Jun 25, 2026, 7:40:32 PM (4 days ago) Jun 25
    to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez and Yishui Liu

    Nasko Oskov added 1 comment

    File components/autofill/core/browser/ui/payments/omnibox_autofill_delegate.h
    Line 65, Patchset 17 (Latest): void OnFieldBecameVisible();
    Nasko Oskov . unresolved

    Shouldn't this be `override`? Also, it comes from the mojo interface, but this class hasn't added inheritance from the mojo interface. I'm not sure I follow how this works as I also don't see what code calls ObserveFieldVisibility.

    Fernando Ramirez

    `OnFieldBecameVisible` is not an override because `OmniboxAutofillDelegate` is a core browser class that doesn't implement mojo interfaces directly.

    Instead, this is handled in `ContentAutofillDriver`, which translates the incoming mojo notification back to this C++ callback.

    This call to the driver is implemented by @yis...@google.com in crrev.com/c/7944884 like this:

    ```
    manager.driver().ObserveFieldVisibility(
    /*field_id=*/trigger_field_global_id_,
    /*callback=*/
    base::BindOnce(&OmniboxAutofillDelegate::OnFieldBecameVisible,
    weak_ptr_factory_.GetWeakPtr()));
    ```
    Nasko Oskov

    I am not sure I follow. When you have a mojo interface, the receiving end is usually a class that inherits the mojo interface definition and provides the receiving method implementation. In this CL's case, some class must provide the `OnFieldBecameVisible` implementation and I do not see it. Therefore this CL does not seem to actually have working implementation of the functionality of receiving the call from the renderer process.

    If you look at szager@'s comment he raises similar point - you have not implemented the interface you are adding and you should, as this is what we expect when adding mojo API surface - implementation is in the same CL so it can be reviewed for correctness.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fernando Ramirez
    • Yishui Liu
    Gerrit-Attention: Yishui Liu <yis...@google.com>
    Gerrit-Attention: Fernando Ramirez <fe...@google.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 23:40:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
    Comment-In-Reply-To: Fernando Ramirez <fe...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Christoph Schwering (Gerrit)

    unread,
    Jun 26, 2026, 6:31:00 AM (3 days ago) Jun 26
    to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez and Yishui Liu

    Christoph Schwering voted and added 1 comment

    Votes added by Christoph Schwering

    Code-Review+1

    1 comment

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 11, Patchset 17 (Latest):interface AutofillVisibilityObserver {
    Stefan Zager . unresolved

    There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

    Christoph Schwering

    Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

    Gerrit-Comment-Date: Fri, 26 Jun 2026 10:30:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stefan Zager (Gerrit)

    unread,
    Jun 26, 2026, 11:54:07 AM (3 days ago) Jun 26
    to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez and Yishui Liu

    Stefan Zager added 1 comment

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 11, Patchset 17 (Latest):interface AutofillVisibilityObserver {
    Stefan Zager . unresolved

    There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

    Christoph Schwering

    Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

    Stefan Zager

    I don't think that's true, as long as the `FieldRendererId` is passed through.

    Gerrit-Comment-Date: Fri, 26 Jun 2026 15:53:53 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
    Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Christoph Schwering (Gerrit)

    unread,
    Jun 26, 2026, 12:28:37 PM (3 days ago) Jun 26
    to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez and Yishui Liu

    Christoph Schwering added 1 comment

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 11, Patchset 17 (Latest):interface AutofillVisibilityObserver {
    Stefan Zager . unresolved

    There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

    Christoph Schwering

    Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

    Stefan Zager

    I don't think that's true, as long as the `FieldRendererId` is passed through.

    Christoph Schwering

    If `[Content]AutofillDriver` *is* the `AutofillVisiblityObserver`, how could it inform different of `AutofillDriver::ObserveFieldVisibility()` when a field became visible?

    I think the straightforward API is to make `mojom::PendingRemote<AutofillVisibilityObserver>` a parameter of `ContentAutofillDriver::ObserveFieldVisibility()`. Then it's the callers job to implement `AutofillVisiblityObserver` to their liking.

    (Currently, `AutofillAgent` of course only supports one simultaneous observer. But IMO the API should be so that we can support multiple, so that we only need to make small changes to `AutofillAgent` when some other part of the code wants to observe field visibility.)

    Gerrit-Comment-Date: Fri, 26 Jun 2026 16:28:17 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yishui Liu (Gerrit)

    unread,
    Jun 26, 2026, 2:12:25 PM (3 days ago) Jun 26
    to Fernando Ramirez, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Fernando Ramirez

    Yishui Liu added 1 comment

    File components/autofill/content/common/mojom/autofill_agent.mojom
    Line 11, Patchset 17 (Latest):interface AutofillVisibilityObserver {
    Stefan Zager . unresolved

    There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

    Christoph Schwering

    Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

    Stefan Zager

    I don't think that's true, as long as the `FieldRendererId` is passed through.

    Christoph Schwering

    If `[Content]AutofillDriver` *is* the `AutofillVisiblityObserver`, how could it inform different of `AutofillDriver::ObserveFieldVisibility()` when a field became visible?

    I think the straightforward API is to make `mojom::PendingRemote<AutofillVisibilityObserver>` a parameter of `ContentAutofillDriver::ObserveFieldVisibility()`. Then it's the callers job to implement `AutofillVisiblityObserver` to their liking.

    (Currently, `AutofillAgent` of course only supports one simultaneous observer. But IMO the API should be so that we can support multiple, so that we only need to make small changes to `AutofillAgent` when some other part of the code wants to observe field visibility.)

    Yishui Liu

    I think we need to put this interface in `components/autofill/core/common/mojom/autofill_types.mojom` if we want to implement it `AutofillOmniboxDelegate`, since both `autofill_driver.mojom` and `autofill_agent.mojom` are under `components/autofill/content/` which is not allowed to be included in [components/autofill/core files](https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/DEPS;l=15?q=components%2Fautofill%2FDEPS).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fernando Ramirez
    Gerrit-Attention: Fernando Ramirez <fe...@google.com>
    Gerrit-Comment-Date: Fri, 26 Jun 2026 18:12:13 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fernando Ramirez (Gerrit)

    unread,
    Jun 26, 2026, 3:07:47 PM (3 days ago) Jun 26
    to Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
    Attention needed from Christoph Schwering, Nasko Oskov and Stefan Zager

    Fernando Ramirez added 8 comments

    File components/autofill/core/browser/ui/payments/omnibox_autofill_delegate.h
    Line 65, Patchset 17: void OnFieldBecameVisible();
    Nasko Oskov . resolved

    Shouldn't this be `override`? Also, it comes from the mojo interface, but this class hasn't added inheritance from the mojo interface. I'm not sure I follow how this works as I also don't see what code calls ObserveFieldVisibility.

    Fernando Ramirez

    `OnFieldBecameVisible` is not an override because `OmniboxAutofillDelegate` is a core browser class that doesn't implement mojo interfaces directly.

    Instead, this is handled in `ContentAutofillDriver`, which translates the incoming mojo notification back to this C++ callback.

    This call to the driver is implemented by @yis...@google.com in crrev.com/c/7944884 like this:

    ```
    manager.driver().ObserveFieldVisibility(
    /*field_id=*/trigger_field_global_id_,
    /*callback=*/
    base::BindOnce(&OmniboxAutofillDelegate::OnFieldBecameVisible,
    weak_ptr_factory_.GetWeakPtr()));
    ```
    Nasko Oskov

    I am not sure I follow. When you have a mojo interface, the receiving end is usually a class that inherits the mojo interface definition and provides the receiving method implementation. In this CL's case, some class must provide the `OnFieldBecameVisible` implementation and I do not see it. Therefore this CL does not seem to actually have working implementation of the functionality of receiving the call from the renderer process.

    If you look at szager@'s comment he raises similar point - you have not implemented the interface you are adding and you should, as this is what we expect when adding mojo API surface - implementation is in the same CL so it can be reviewed for correctness.

    Fernando Ramirez

    Ah I understand now, I have added the proper override for this method.

    File components/autofill/core/common/mojom/autofill_types.mojom
    Line 617, Patchset 20 (Latest):interface AutofillVisibilityObserver {
    Fernando Ramirez . unresolved

    Like @yis...@google.com [pointed out](https://chromium-review.git.corp.google.com/c/chromium/src/+/7870348/comment/0f21bb4e_93b8e873/), since `autofill_agent.mojom` is within the `components/autofill/content` directory, [we cannot include](https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/DEPS;l=15;drc=ae572bef3647189819f1371c5da4841b25afa124) this header within `omnibox_autofill_delegate.h`.

    `autofill_types.mojom` is already included in `autofill_agent.h` and is within the `components/autofill/core` directory so it can be included in `omnibox_autofill_delegate.h`. That's why `AutofillVisibilityObserver` was moved to this file. I'm happy to also move this interface to a different file.

    File third_party/blink/public/web/web_element.h
    Line 233, Patchset 17: base::OnceCallback<void(bool)> callback) const;
    Stefan Zager . resolved

    I don't think `const` is correct here.

    Fernando Ramirez

    Done

    Line 45, Patchset 17:class TimeDelta;
    Stefan Zager . resolved

    This is a bit weird -- `MonitorVisibility` takes a concrete (non-pointer non-reference) `TimeDelta` argument, so this header must be able to access the class definition for `TimeDelta`. Seems like this should either be an `#include` (following the rule of "Include What You Use"), or this advance declaration should be superfluous.

    Fernando Ramirez

    I've added the include for this header and removed the forward declaration.

    File third_party/blink/renderer/core/exported/web_element.cc
    Line 581, Patchset 17: element->GetDocument().GetTaskRunner(TaskType::kUserInteraction),
    Stefan Zager . resolved

    This should be the default task runner; this task shouldn't compete with input events.

    Line 593, Patchset 17: observer_ = IntersectionObserver::Create(
    Stefan Zager . resolved

    This overload of `Create` is meant only to support construction from javascript. For blink-internal usage like this, you should use:

    https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/intersection_observer/intersection_observer.cc;drc=5650b3485eaa8443ee812a44056a1b88b4ee0ce1;l=305

    This implies that `VisibilityObserver` need not inherit from `IntersectionObserverDelegate`. This probable makes some of the new `#include`'s unnecessary.

    Fernando Ramirez

    Got it, using this new `Create` function takes in a `Param` object. An extra param that I didn't know of before is `root`. Looking at this comment, it seems like providing `nullptr` to root would observe the top-level frame's viewport: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/intersection_observer/intersection_observer.h;l=163-167;drc=5650b3485eaa8443ee812a44056a1b88b4ee0ce1

    Line 629, Patchset 17: DeliverResult(false);
    Stefan Zager . resolved

    This doesn't seem possible.

    Fernando Ramirez

    You're right, this function is only called within `WebElement::MonitorVisibility` when it should have both an `element_` and an `observer_`.

    Line 656, Patchset 17: visibility_timer_.Stop();
    Stefan Zager . resolved

    Should this be moved outside the `if` clause?

    Fernando Ramirez

    Yes, I think this is safer.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Christoph Schwering
    • Nasko Oskov
    • Stefan Zager
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • 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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
      Gerrit-Change-Number: 7870348
      Gerrit-PatchSet: 20
      Gerrit-Owner: Fernando Ramirez <fe...@google.com>
      Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
      Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
      Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
      Gerrit-Reviewer: Olivia Saul <os...@google.com>
      Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
      Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
      Gerrit-CC: Yishui Liu <yis...@google.com>
      Gerrit-CC: gwsq
      Gerrit-Attention: Nasko Oskov <na...@chromium.org>
      Gerrit-Attention: Stefan Zager <sza...@chromium.org>
      Gerrit-Attention: Christoph Schwering <schw...@google.com>
      Gerrit-Comment-Date: Fri, 26 Jun 2026 19:07:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Nasko Oskov <na...@chromium.org>
      Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
      Comment-In-Reply-To: Fernando Ramirez <fe...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Christoph Schwering (Gerrit)

      unread,
      Jun 26, 2026, 3:49:56 PM (3 days ago) Jun 26
      to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Stefan Zager, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
      Attention needed from Fernando Ramirez, Nasko Oskov and Stefan Zager

      Christoph Schwering voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fernando Ramirez
      • Nasko Oskov
      • Stefan Zager
      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: If057764b5492f1fcaaf5ca0e1eaf41c8b72de930
        Gerrit-Change-Number: 7870348
        Gerrit-PatchSet: 20
        Gerrit-Owner: Fernando Ramirez <fe...@google.com>
        Gerrit-Reviewer: Christoph Schwering <schw...@google.com>
        Gerrit-Reviewer: Fernando Ramirez <fe...@google.com>
        Gerrit-Reviewer: Nasko Oskov <na...@chromium.org>
        Gerrit-Reviewer: Olivia Saul <os...@google.com>
        Gerrit-Reviewer: Stefan Zager <sza...@chromium.org>
        Gerrit-CC: Chromium IPC Reviews <chrome-ip...@google.com>
        Gerrit-CC: Yishui Liu <yis...@google.com>
        Gerrit-CC: gwsq
        Gerrit-Attention: Nasko Oskov <na...@chromium.org>
        Gerrit-Attention: Stefan Zager <sza...@chromium.org>
        Gerrit-Attention: Fernando Ramirez <fe...@google.com>
        Gerrit-Comment-Date: Fri, 26 Jun 2026 19:49:37 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Stefan Zager (Gerrit)

        unread,
        Jun 26, 2026, 5:00:03 PM (3 days ago) Jun 26
        to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
        Attention needed from Fernando Ramirez and Nasko Oskov

        Stefan Zager added 1 comment

        File components/autofill/content/common/mojom/autofill_agent.mojom
        Line 11, Patchset 17:interface AutofillVisibilityObserver {
        Stefan Zager . unresolved

        There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

        Christoph Schwering

        Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

        Stefan Zager

        I don't think that's true, as long as the `FieldRendererId` is passed through.

        Christoph Schwering

        If `[Content]AutofillDriver` *is* the `AutofillVisiblityObserver`, how could it inform different of `AutofillDriver::ObserveFieldVisibility()` when a field became visible?

        I think the straightforward API is to make `mojom::PendingRemote<AutofillVisibilityObserver>` a parameter of `ContentAutofillDriver::ObserveFieldVisibility()`. Then it's the callers job to implement `AutofillVisiblityObserver` to their liking.

        (Currently, `AutofillAgent` of course only supports one simultaneous observer. But IMO the API should be so that we can support multiple, so that we only need to make small changes to `AutofillAgent` when some other part of the code wants to observe field visibility.)

        Yishui Liu

        I think we need to put this interface in `components/autofill/core/common/mojom/autofill_types.mojom` if we want to implement it `AutofillOmniboxDelegate`, since both `autofill_driver.mojom` and `autofill_agent.mojom` are under `components/autofill/content/` which is not allowed to be included in [components/autofill/core files](https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/DEPS;l=15?q=components%2Fautofill%2FDEPS).

        Stefan Zager

        `AutofillAgent` and `AutofillDriver` form a conjoined pair; the first one handles browser-to-renderer messages and the second one handles renderer-to-browser messages. It makes sense to me that the "start observing this element for visibility" message would be sent from the browser via AutofillAgent mojo, and the "this element is now visible" would be reported back via AutofillDriver mojo. Am I missing something?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Fernando Ramirez
        • Nasko Oskov
        Gerrit-Attention: Fernando Ramirez <fe...@google.com>
        Gerrit-Comment-Date: Fri, 26 Jun 2026 20:59:41 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Stefan Zager <sza...@chromium.org>
        Comment-In-Reply-To: Yishui Liu <yis...@google.com>
        Comment-In-Reply-To: Christoph Schwering <schw...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Stefan Zager (Gerrit)

        unread,
        Jun 27, 2026, 2:11:04 PM (2 days ago) Jun 27
        to Fernando Ramirez, Yishui Liu, Chromium IPC Reviews, Olivia Saul, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, siashah+au...@chromium.org, shgar+aut...@google.com, siyua+aut...@chromium.org, vinnypersky+...@google.com, osaul+aut...@google.com, armalhotra+a...@google.com, blink-...@chromium.org, blink-rev...@chromium.org, blink-re...@chromium.org, browser-comp...@chromium.org
        Attention needed from Fernando Ramirez and Nasko Oskov

        Stefan Zager added 1 comment

        File components/autofill/content/common/mojom/autofill_agent.mojom
        Line 11, Patchset 17:interface AutofillVisibilityObserver {
        Stefan Zager . unresolved

        There are no implementations of this as yet, I assume that will be in a follow-up? Any particular reason why this method couldn't just be added to `AutofillDriver`, defined in `autofill_driver.mojom`?

        Christoph Schwering

        Making `AutofillDriver` the `AutofillVisibilityObserver` sounds wrong to me because then we can have only one `AutofillVisibilityObserver` at a time.

        Stefan Zager

        I don't think that's true, as long as the `FieldRendererId` is passed through.

        Christoph Schwering

        If `[Content]AutofillDriver` *is* the `AutofillVisiblityObserver`, how could it inform different of `AutofillDriver::ObserveFieldVisibility()` when a field became visible?

        I think the straightforward API is to make `mojom::PendingRemote<AutofillVisibilityObserver>` a parameter of `ContentAutofillDriver::ObserveFieldVisibility()`. Then it's the callers job to implement `AutofillVisiblityObserver` to their liking.

        (Currently, `AutofillAgent` of course only supports one simultaneous observer. But IMO the API should be so that we can support multiple, so that we only need to make small changes to `AutofillAgent` when some other part of the code wants to observe field visibility.)

        Yishui Liu

        I think we need to put this interface in `components/autofill/core/common/mojom/autofill_types.mojom` if we want to implement it `AutofillOmniboxDelegate`, since both `autofill_driver.mojom` and `autofill_agent.mojom` are under `components/autofill/content/` which is not allowed to be included in [components/autofill/core files](https://source.chromium.org/chromium/chromium/src/+/main:components/autofill/DEPS;l=15?q=components%2Fautofill%2FDEPS).

        Stefan Zager

        `AutofillAgent` and `AutofillDriver` form a conjoined pair; the first one handles browser-to-renderer messages and the second one handles renderer-to-browser messages. It makes sense to me that the "start observing this element for visibility" message would be sent from the browser via AutofillAgent mojo, and the "this element is now visible" would be reported back via AutofillDriver mojo. Am I missing something?

        Stefan Zager

        To be clear: I don't see the need for `AutofillVisibilityObserver` as a new stand-alone interface. It seems like it should be possible and straightforward to route the renderer->browswer message to `OmniboxAutofillDelegate` via `AutofillDriver`, without the extra type complexity and lifetime issues.

        Gerrit-Comment-Date: Sat, 27 Jun 2026 18:10:46 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages