Refactor NavigationInitiatorActivationAndAdStatus to 2 bools [chromium/src : main]

0 views
Skip to first unread message

Yao Xiao (Gerrit)

unread,
Dec 18, 2025, 8:55:14 AM (2 days ago) Dec 18
to Daniel Cheng, Josh Karlin, Rakina Zata Amni, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
Attention needed from Daniel Cheng, Josh Karlin and Rakina Zata Amni

Yao Xiao added 2 comments

Patchset-level comments
File-level comment, Patchset 14 (Latest):
Yao Xiao . resolved

rakina@/dcheng@/jkarlin@: Per Josh's suggestion, I've refactored this CL to use 2 bools. This now affects more files and I've included specific implementation notes in the updated CL description. Please take another look. Thanks!

File third_party/blink/public/mojom/navigation/navigation_initiator_activation_and_ad_status.mojom
Line 17, Patchset 7:enum NavigationInitiatorActivationAndAdStatus {
Josh Karlin . resolved

I'd strongly prefer 2 bools to this squashing of rather different concepts (transient activation and ad relatedness). For instance, the code in render_frame_host_impl.cc is quite verbose. I further see that the code then tries to work back from this 4-state enum into boolean values almost everywhere that it's actually used. Let's just use bools.

Josh Karlin

or 2-state enums for type safety

Yao Xiao

Done. I use 2 bools instead of 2-state enums to match existing patterns.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Josh Karlin
  • Rakina Zata Amni
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: I82347f5c629a2287ef44a64c13ba08acd011e4b0
Gerrit-Change-Number: 7257976
Gerrit-PatchSet: 14
Gerrit-Owner: Yao Xiao <yao...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Josh Karlin <jka...@chromium.org>
Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Reviewer: Yao Xiao <yao...@chromium.org>
Gerrit-CC: Christian Biesinger <cbies...@chromium.org>
Gerrit-CC: Kaan Icer <ic...@chromium.org>
Gerrit-Attention: Josh Karlin <jka...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
Gerrit-Comment-Date: Thu, 18 Dec 2025 13:54:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Josh Karlin <jka...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Josh Karlin (Gerrit)

unread,
Dec 18, 2025, 9:44:57 AM (2 days ago) Dec 18
to Yao Xiao, Josh Karlin, Daniel Cheng, Rakina Zata Amni, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
Attention needed from Daniel Cheng, Rakina Zata Amni and Yao Xiao

Josh Karlin voted and added 3 comments

Votes added by Josh Karlin

Code-Review+1

3 comments

Patchset-level comments
Josh Karlin . resolved

lgtm

File content/browser/fenced_frame/fenced_frame.cc
Line 159, Patchset 14 (Latest): // TODO(yaoxia): Implement `started_by_ad` and `has_user_gesture`. This
Josh Karlin . unresolved

Can you create a bug for this?

File third_party/blink/public/mojom/navigation/navigation_initiator_activation_and_ad_status.mojom
Line 17, Patchset 7:enum NavigationInitiatorActivationAndAdStatus {
Josh Karlin . resolved

I'd strongly prefer 2 bools to this squashing of rather different concepts (transient activation and ad relatedness). For instance, the code in render_frame_host_impl.cc is quite verbose. I further see that the code then tries to work back from this 4-state enum into boolean values almost everywhere that it's actually used. Let's just use bools.

Josh Karlin

or 2-state enums for type safety

Yao Xiao

Done. I use 2 bools instead of 2-state enums to match existing patterns.

Josh Karlin

Thanks, this is much better!

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Rakina Zata Amni
  • Yao Xiao
    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: I82347f5c629a2287ef44a64c13ba08acd011e4b0
      Gerrit-Change-Number: 7257976
      Gerrit-PatchSet: 14
      Gerrit-Owner: Yao Xiao <yao...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Josh Karlin <jka...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Yao Xiao <yao...@chromium.org>
      Gerrit-CC: Christian Biesinger <cbies...@chromium.org>
      Gerrit-CC: Kaan Icer <ic...@chromium.org>
      Gerrit-Attention: Yao Xiao <yao...@chromium.org>
      Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
      Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Comment-Date: Thu, 18 Dec 2025 14:44:48 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Yao Xiao <yao...@chromium.org>
      Comment-In-Reply-To: Josh Karlin <jka...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Daniel Cheng (Gerrit)

      unread,
      Dec 18, 2025, 11:05:41 AM (2 days ago) Dec 18
      to Yao Xiao, Dominic Farolino, Josh Karlin, Daniel Cheng, Rakina Zata Amni, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
      Attention needed from Dominic Farolino, Rakina Zata Amni and Yao Xiao

      Daniel Cheng added 1 comment

      Patchset-level comments
      Daniel Cheng . unresolved

      Sorry for missing this CL; I've been out a bit for personal reasons.

      @d...@chromium.org, can you help with reviewing this? I'll stamp afterwards.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dominic Farolino
      • Rakina Zata Amni
      • Yao Xiao
      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: I82347f5c629a2287ef44a64c13ba08acd011e4b0
      Gerrit-Change-Number: 7257976
      Gerrit-PatchSet: 14
      Gerrit-Owner: Yao Xiao <yao...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
      Gerrit-Reviewer: Josh Karlin <jka...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Yao Xiao <yao...@chromium.org>
      Gerrit-CC: Christian Biesinger <cbies...@chromium.org>
      Gerrit-CC: Kaan Icer <ic...@chromium.org>
      Gerrit-Attention: Yao Xiao <yao...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Comment-Date: Thu, 18 Dec 2025 16:05:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Charlie Reis (Gerrit)

      unread,
      Dec 18, 2025, 2:14:28 PM (2 days ago) Dec 18
      to Yao Xiao, Dominic Farolino, Josh Karlin, Daniel Cheng, Rakina Zata Amni, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
      Attention needed from Dominic Farolino, Rakina Zata Amni and Yao Xiao

      Charlie Reis added 1 comment

      File content/browser/renderer_host/navigation_controller_impl.h
      Line 761, Patchset 14 (Latest): bool from_frame_proxy,
      Charlie Reis . unresolved

      Quick drive-by note: It looks risky to change a bool's meaning without the compiler requiring any changes to callers. If we aren't going to use enums (which seems safer), can this parameter at least be moved elsewhere in the parameter list so that the code won't compile until all the callers have been updated to pass `from_frame_proxy` and not `has_user_gesture`?

      Also, the new parameter should be documented.

      Gerrit-CC: Charlie Reis <cr...@chromium.org>
      Gerrit-CC: Christian Biesinger <cbies...@chromium.org>
      Gerrit-CC: Kaan Icer <ic...@chromium.org>
      Gerrit-Attention: Yao Xiao <yao...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Comment-Date: Thu, 18 Dec 2025 19:14:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yao Xiao (Gerrit)

      unread,
      Dec 18, 2025, 9:57:11 PM (2 days ago) Dec 18
      to Charlie Reis, Dominic Farolino, Josh Karlin, Daniel Cheng, Rakina Zata Amni, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
      Attention needed from Charlie Reis, Dominic Farolino and Rakina Zata Amni

      Yao Xiao added 2 comments

      File content/browser/fenced_frame/fenced_frame.cc
      Line 159, Patchset 14: // TODO(yaoxia): Implement `started_by_ad` and `has_user_gesture`. This
      Josh Karlin . resolved

      Can you create a bug for this?

      Yao Xiao

      Done. Created crbug.com/470115250 and updated the TODO link.

      File content/browser/renderer_host/navigation_controller_impl.h
      Line 761, Patchset 14: bool from_frame_proxy,
      Charlie Reis . resolved

      Quick drive-by note: It looks risky to change a bool's meaning without the compiler requiring any changes to callers. If we aren't going to use enums (which seems safer), can this parameter at least be moved elsewhere in the parameter list so that the code won't compile until all the callers have been updated to pass `from_frame_proxy` and not `has_user_gesture`?

      Also, the new parameter should be documented.

      Yao Xiao

      Done. I reordered the parameters to force compilation errors at call sites that haven't been updated. Also documented the new param.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Charlie Reis
      • Dominic Farolino
      • Rakina Zata Amni
      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: I82347f5c629a2287ef44a64c13ba08acd011e4b0
      Gerrit-Change-Number: 7257976
      Gerrit-PatchSet: 15
      Gerrit-Owner: Yao Xiao <yao...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
      Gerrit-Reviewer: Josh Karlin <jka...@chromium.org>
      Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Reviewer: Yao Xiao <yao...@chromium.org>
      Gerrit-CC: Charlie Reis <cr...@chromium.org>
      Gerrit-CC: Christian Biesinger <cbies...@chromium.org>
      Gerrit-CC: Kaan Icer <ic...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Charlie Reis <cr...@chromium.org>
      Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
      Gerrit-Comment-Date: Fri, 19 Dec 2025 02:56:42 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Josh Karlin <jka...@chromium.org>
      Comment-In-Reply-To: Charlie Reis <cr...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Rakina Zata Amni (Gerrit)

      unread,
      Dec 19, 2025, 8:10:08 AM (21 hours ago) Dec 19
      to Yao Xiao, Charlie Reis, Dominic Farolino, Josh Karlin, Daniel Cheng, AyeAye, Chromium LUCI CQ, Christian Biesinger, chromium...@chromium.org, Kaan Icer, blink-revi...@chromium.org, alexmo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, chromium-a...@chromium.org, creis...@chromium.org, csharris...@chromium.org, dmurph+wat...@chromium.org, ipc-securi...@chromium.org, kinuko...@chromium.org, loading-rev...@chromium.org, loading...@chromium.org, navigation...@chromium.org, npm+...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org, subresource-f...@chromium.org, webap...@microsoft.com, yigu+...@chromium.org
      Attention needed from Charlie Reis, Dominic Farolino and Yao Xiao

      Rakina Zata Amni added 2 comments

      File content/renderer/render_frame_impl.cc
      Line 6203, Patchset 15 (Latest): /*started_with_transient_activation*/
      Rakina Zata Amni . unresolved

      nit: add `=`

      File third_party/blink/public/mojom/navigation/navigation_initiator_activation_and_ad_status.mojom
      Line 17, Patchset 7:enum NavigationInitiatorActivationAndAdStatus {
      Josh Karlin . unresolved

      I'd strongly prefer 2 bools to this squashing of rather different concepts (transient activation and ad relatedness). For instance, the code in render_frame_host_impl.cc is quite verbose. I further see that the code then tries to work back from this 4-state enum into boolean values almost everywhere that it's actually used. Let's just use bools.

      Josh Karlin

      or 2-state enums for type safety

      Yao Xiao

      Done. I use 2 bools instead of 2-state enums to match existing patterns.

      Josh Karlin

      Thanks, this is much better!

      Rakina Zata Amni

      Thanks, I think looking at the changed usages of the previous enum, it looks like it has grown out of its initial use of ads-specific case, so decoupling them is the right move. However I think having a new `has_transient_activation` field separate from the existing `CommonNavigationParams` `has_user_gesture` field is likely to be confusing even with the comments, as it isn't obvious if someone needs to think about which one to use.

      I think this might be the time to make `has_user_gesture` to be an enum with the {"no / filtered user gesture", "has user gesture, but filter before sending to renderer", "has user_gesture, no need to filter"} states (from the previous [discussion](https://chromium-review.googlesource.com/c/chromium/src/+/4017155/comment/fb7b8b4f_defa6f15/) on this). Or if that is going to affect too many code (likely), maybe a reasonable alternative is to make it very clear that the states are linked with comments but also by naming the new bool `has_user_gesture_unfiltered` or the old one `has_transient_user_activation_filtered` or something like that. WDYT?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Charlie Reis
      • Dominic Farolino
      • Yao Xiao
      Gerrit-Attention: Yao Xiao <yao...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Charlie Reis <cr...@chromium.org>
      Gerrit-Comment-Date: Fri, 19 Dec 2025 13:09:41 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages