[iOS] Update badges flow based on visibility [chromium/src : main]

0 views
Skip to first unread message

Gauthier Ambard (Gerrit)

unread,
Apr 2, 2026, 11:20:34 AM (3 days ago) Apr 2
to Joemer Ramos, Ibrahim Kanouche, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Ibrahim Kanouche and Joemer Ramos

Gauthier Ambard voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Ibrahim Kanouche
  • Joemer Ramos
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
Gerrit-Change-Number: 7726402
Gerrit-PatchSet: 4
Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
Gerrit-Attention: Joemer Ramos <joeme...@google.com>
Gerrit-Attention: Ibrahim Kanouche <kano...@google.com>
Gerrit-Comment-Date: Thu, 02 Apr 2026 15:20:18 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Joemer Ramos (Gerrit)

unread,
Apr 2, 2026, 12:07:23 PM (3 days ago) Apr 2
to Gauthier Ambard, Chromium LUCI CQ, Joemer Ramos, Ibrahim Kanouche, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
Attention needed from Ibrahim Kanouche

Joemer Ramos added 11 comments

Patchset-level comments
File-level comment, Patchset 4:
Joemer Ramos . resolved

Thanks Gauthier, yeah this looks a lot better.

File ios/chrome/browser/badges/ui_bundled/badge_mediator.h
Line 30, Patchset 5 (Latest):// Whether this badge mediator is visible or not.
Joemer Ramos . unresolved

Let's add a statement on what this property does. If YES, becomes the delegate for `InfobarTabHelper`. If NO, removed as the delegate for `InfobarTabHelper`.

Line 31, Patchset 4:@property(nonatomic, assign) BOOL visible;
Joemer Ramos . unresolved

Mediators aren't visible, maybe `active`?

File ios/chrome/browser/location_bar/ui_bundled/location_bar_coordinator.h
Line 82, Patchset 5 (Latest):- (void)setLocationBarVisible:(BOOL)visible;
Joemer Ramos . unresolved

Same nit here `setLocationBarActive`

File ios/chrome/browser/toolbar/coordinator/main_toolbar_coordinator.mm
Line 102, Patchset 5 (Latest): MainToolbarMediator* _mainToolbarMediator;
Joemer Ramos . unresolved

nit: Comment above var

Line 195, Patchset 5 (Latest): [self createLocationBarCoordinatorVisible:!isOmniboxInBottomPosition];
Joemer Ramos . unresolved

Coordinators aren't really visible either, maybe `createLocationBarCoordinatorActive:(BOOL)active` wdyt?

Line 1179, Patchset 5 (Latest): [_topLocationBarCoordinator setLocationBarVisible:NO];
Joemer Ramos . unresolved

Related to the comment in `badge_mediator`, what if we do an encompassing general function here:
`[_topLocationBarCoordinator setLocationBarActive:NO];` maybe updates from other components might be needed related to the omnibox position changing. wdyt?

File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.h
Line 37, Patchset 5 (Latest):/// Disconnects the observation.
Joemer Ramos . unresolved

Nit: Used to disconnect any observations and clean up objects. (or something along those lines). This function may not be **only** used for disconnecting an observation.

Line 25, Patchset 5 (Latest):/// The delegate to notify about changes.
Joemer Ramos . unresolved

nit: to notify the mediator about changes.

Line 22, Patchset 5 (Latest):/// Mediator for the main toolbar, observing preferences.
Joemer Ramos . unresolved

nit:maybe more specific? observing preferences for omnibox positions?

File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.mm
Line 16, Patchset 5 (Latest): PrefBackedBoolean* _bottomOmniboxEnabled;
Joemer Ramos . unresolved

nit: comment above var.

Open in Gerrit

Related details

Attention is currently required from:
  • Ibrahim Kanouche
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
    Gerrit-Change-Number: 7726402
    Gerrit-PatchSet: 5
    Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Comment-Date: Thu, 02 Apr 2026 16:07:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ibrahim Kanouche (Gerrit)

    unread,
    Apr 2, 2026, 6:55:12 PM (3 days ago) Apr 2
    to Gauthier Ambard, Chromium LUCI CQ, Joemer Ramos, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
    Attention needed from Gauthier Ambard

    Ibrahim Kanouche added 12 comments

    Patchset-level comments
    File-level comment, Patchset 5 (Latest):
    Ibrahim Kanouche . resolved

    Thanks

    File ios/chrome/browser/badges/ui_bundled/badge_mediator.mm
    Line 248, Patchset 5 (Latest): if (visible) {
    Ibrahim Kanouche . unresolved

    When visible transitions to NO, the InfobarBadgeTabHelper still holds this mediator as its delegate. This might be an issue if the badge tab helper later calls back into this mediator while it's "invisible".

    Can we add an else branch where we call SetDelegate(nil) and clear badges?

    Line 248, Patchset 5 (Latest): if (visible) {
    Ibrahim Kanouche . unresolved

    nit: When becoming invisible, should the consumer also be notified to clear its displayed badges? Currently the consumer retains whatever badge state it had when this mediator was last visible. I am thinking if the UI for the hidden toolbar is still technically alive (just not the active one), it could display stale badges when it becomes visible again before `updateBadgesShownForWebState` runs.

    Line 250, Patchset 5 (Latest): InfobarBadgeTabHelper::FromWebState(_webState)->SetDelegate(self);
    Ibrahim Kanouche . unresolved

    nit: Inconsistent use of self.webState and _webState within the same block.

    File ios/chrome/browser/location_bar/ui_bundled/location_bar_coordinator.h
    Line 82, Patchset 5 (Latest):- (void)setLocationBarVisible:(BOOL)visible;
    Joemer Ramos . unresolved

    Same nit here `setLocationBarActive`

    Ibrahim Kanouche

    nit: The name setLocationBarVisible (or setLocationBarActive) implies it controls the location bar's own visibility, but it actually controls the badge mediator's delegate registration. Maybe `setBadgeMediatorActive` or `setLocationBarBadgesActive`?

    File ios/chrome/browser/location_bar/ui_bundled/location_bar_coordinator.mm
    Line 355, Patchset 5 (Latest): if (isIncognito && !IsChromeNextIaEnabled()) {
    Ibrahim Kanouche . unresolved

    Can we add a brief comment here explaining the replacement for incognito indicator as part of bling next (This would help future readers who lack context)?

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_coordinator.mm
    Line 1174, Patchset 5 (Latest):#pragma mark - MainToolbarMediatorDelegate
    Ibrahim Kanouche . unresolved

    Can we move the delegate protocol implementations before the Private methods.

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.h
    Line 32, Patchset 5 (Latest):- (instancetype)init NS_UNAVAILABLE;
    Ibrahim Kanouche . unresolved

    should we also mark `new` as unavailable to prevent `[MainToolbarMediator new]`?

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.mm
    Line 16, Patchset 5 (Latest): PrefBackedBoolean* _bottomOmniboxEnabled;
    Joemer Ramos . unresolved

    nit: comment above var.

    Ibrahim Kanouche

    nit: `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Line 16, Patchset 5 (Latest): PrefBackedBoolean* _bottomOmniboxEnabled;
    Ibrahim Kanouche . unresolved

    `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Line 16, Patchset 5 (Latest): PrefBackedBoolean* _bottomOmniboxEnabled;
    Ibrahim Kanouche . unresolved

    `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Line 42, Patchset 5 (Latest):- (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean {
    Ibrahim Kanouche . unresolved

    The coordinator's isOmniboxInBottomPosition guards on IsBottomOmniboxAvailable(), but this callback fires unconditionally when the pref changes. On devices where bottom omnibox isn't available (e.g.iPad), a pref toggle would still notify the delegate and trigger setLocationBarVisible: calls with incorrect values. We should either not observe the pref when !IsBottomOmniboxAvailable(), or add the guard here before calling the delegate.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Gauthier Ambard
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
    Gerrit-Change-Number: 7726402
    Gerrit-PatchSet: 5
    Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Comment-Date: Thu, 02 Apr 2026 22:55:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joemer Ramos <joeme...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Gauthier Ambard (Gerrit)

    unread,
    Apr 3, 2026, 4:05:11 AM (2 days ago) Apr 3
    to Chromium LUCI CQ, Joemer Ramos, Ibrahim Kanouche, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
    Attention needed from Ibrahim Kanouche and Joemer Ramos

    Gauthier Ambard voted and added 19 comments

    Votes added by Gauthier Ambard

    Commit-Queue+1

    19 comments

    File ios/chrome/browser/badges/ui_bundled/badge_mediator.h
    Line 30, Patchset 5:// Whether this badge mediator is visible or not.
    Joemer Ramos . resolved

    Let's add a statement on what this property does. If YES, becomes the delegate for `InfobarTabHelper`. If NO, removed as the delegate for `InfobarTabHelper`.

    Gauthier Ambard

    Done

    Line 31, Patchset 4:@property(nonatomic, assign) BOOL visible;
    Joemer Ramos . resolved

    Mediators aren't visible, maybe `active`?

    Gauthier Ambard

    Done

    File ios/chrome/browser/badges/ui_bundled/badge_mediator.mm
    Line 248, Patchset 5: if (visible) {
    Ibrahim Kanouche . unresolved

    When visible transitions to NO, the InfobarBadgeTabHelper still holds this mediator as its delegate. This might be an issue if the badge tab helper later calls back into this mediator while it's "invisible".

    Can we add an else branch where we call SetDelegate(nil) and clear badges?

    Gauthier Ambard

    We don't know if we are still the delegate or not when set to NO.
    I have protected the callback to return early if not active.

    Line 248, Patchset 5: if (visible) {
    Ibrahim Kanouche . unresolved

    nit: When becoming invisible, should the consumer also be notified to clear its displayed badges? Currently the consumer retains whatever badge state it had when this mediator was last visible. I am thinking if the UI for the hidden toolbar is still technically alive (just not the active one), it could display stale badges when it becomes visible again before `updateBadgesShownForWebState` runs.

    Gauthier Ambard

    I think it is fine?
    In the sense that some other badges are not done through the badge tab helper, so we can't really fix all of them.
    Also, if we display them before re-calling this method, it means the new badges won't be displayed.

    Line 250, Patchset 5: InfobarBadgeTabHelper::FromWebState(_webState)->SetDelegate(self);
    Ibrahim Kanouche . resolved

    nit: Inconsistent use of self.webState and _webState within the same block.

    Gauthier Ambard

    Done

    File ios/chrome/browser/location_bar/ui_bundled/location_bar_coordinator.h
    Line 82, Patchset 5:- (void)setLocationBarVisible:(BOOL)visible;
    Joemer Ramos . resolved

    Same nit here `setLocationBarActive`

    Ibrahim Kanouche

    nit: The name setLocationBarVisible (or setLocationBarActive) implies it controls the location bar's own visibility, but it actually controls the badge mediator's delegate registration. Maybe `setBadgeMediatorActive` or `setLocationBarBadgesActive`?

    Gauthier Ambard

    This method is about the location bar. It is an implementation details that it is actually only forwarded to the badges. In the future it could be used for something else for example.

    "active" is a good idea.

    I am moving it to setLocationBarActive. I could also move it to setActive.

    File ios/chrome/browser/location_bar/ui_bundled/location_bar_coordinator.mm
    Line 355, Patchset 5: if (isIncognito && !IsChromeNextIaEnabled()) {
    Ibrahim Kanouche . resolved

    Can we add a brief comment here explaining the replacement for incognito indicator as part of bling next (This would help future readers who lack context)?

    Gauthier Ambard

    Moved to another CL.

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_coordinator.mm
    Line 102, Patchset 5: MainToolbarMediator* _mainToolbarMediator;
    Joemer Ramos . resolved

    nit: Comment above var

    Gauthier Ambard

    Done

    Line 195, Patchset 5: [self createLocationBarCoordinatorVisible:!isOmniboxInBottomPosition];
    Joemer Ramos . resolved

    Coordinators aren't really visible either, maybe `createLocationBarCoordinatorActive:(BOOL)active` wdyt?

    Gauthier Ambard

    Done

    Line 1174, Patchset 5:#pragma mark - MainToolbarMediatorDelegate
    Ibrahim Kanouche . resolved

    Can we move the delegate protocol implementations before the Private methods.

    Gauthier Ambard

    Done

    Line 1179, Patchset 5: [_topLocationBarCoordinator setLocationBarVisible:NO];
    Joemer Ramos . unresolved

    Related to the comment in `badge_mediator`, what if we do an encompassing general function here:
    `[_topLocationBarCoordinator setLocationBarActive:NO];` maybe updates from other components might be needed related to the omnibox position changing. wdyt?

    Gauthier Ambard

    I am not sure to understand this comment. Could you clarify?

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.h
    Line 37, Patchset 5:/// Disconnects the observation.
    Joemer Ramos . resolved

    Nit: Used to disconnect any observations and clean up objects. (or something along those lines). This function may not be **only** used for disconnecting an observation.

    Gauthier Ambard

    Done

    Line 32, Patchset 5:- (instancetype)init NS_UNAVAILABLE;
    Ibrahim Kanouche . resolved

    should we also mark `new` as unavailable to prevent `[MainToolbarMediator new]`?

    Gauthier Ambard

    We never do.

    Line 25, Patchset 5:/// The delegate to notify about changes.
    Joemer Ramos . unresolved

    nit: to notify the mediator about changes.

    Gauthier Ambard

    I am not sure to understand. This is the mediator. Why would it notify itself?
    Updated the comment.

    Line 22, Patchset 5:/// Mediator for the main toolbar, observing preferences.
    Joemer Ramos . resolved

    nit:maybe more specific? observing preferences for omnibox positions?

    Gauthier Ambard

    Done

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.mm
    Line 16, Patchset 5: PrefBackedBoolean* _bottomOmniboxEnabled;
    Ibrahim Kanouche . resolved

    `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Gauthier Ambard

    Done

    Line 16, Patchset 5: PrefBackedBoolean* _bottomOmniboxEnabled;
    Ibrahim Kanouche . resolved

    `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Gauthier Ambard

    Done

    Line 16, Patchset 5: PrefBackedBoolean* _bottomOmniboxEnabled;
    Joemer Ramos . resolved

    nit: comment above var.

    Ibrahim Kanouche

    nit: `_bottomOmniboxEnabled` reads like a BOOL flag. How about `_bottomOmniboxPref`?

    Gauthier Ambard

    Done

    Line 42, Patchset 5:- (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean {
    Ibrahim Kanouche . resolved

    The coordinator's isOmniboxInBottomPosition guards on IsBottomOmniboxAvailable(), but this callback fires unconditionally when the pref changes. On devices where bottom omnibox isn't available (e.g.iPad), a pref toggle would still notify the delegate and trigger setLocationBarVisible: calls with incorrect values. We should either not observe the pref when !IsBottomOmniboxAvailable(), or add the guard here before calling the delegate.

    Gauthier Ambard

    I don't fully agree with this. I think the delegate should be notified when the pref changes. However the value should take the availability into account.
    Updated the getter but left this the same.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ibrahim Kanouche
    • Joemer Ramos
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
    Gerrit-Change-Number: 7726402
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Comment-Date: Fri, 03 Apr 2026 08:04:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Joemer Ramos <joeme...@google.com>
    Comment-In-Reply-To: Ibrahim Kanouche <kano...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joemer Ramos (Gerrit)

    unread,
    Apr 3, 2026, 7:56:53 AM (2 days ago) Apr 3
    to Gauthier Ambard, Chromium LUCI CQ, Joemer Ramos, Ibrahim Kanouche, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
    Attention needed from Gauthier Ambard and Ibrahim Kanouche

    Joemer Ramos added 2 comments

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_coordinator.mm
    Line 1179, Patchset 5: [_topLocationBarCoordinator setLocationBarVisible:NO];
    Joemer Ramos . unresolved

    Related to the comment in `badge_mediator`, what if we do an encompassing general function here:
    `[_topLocationBarCoordinator setLocationBarActive:NO];` maybe updates from other components might be needed related to the omnibox position changing. wdyt?

    Gauthier Ambard

    I am not sure to understand this comment. Could you clarify?

    Joemer Ramos

    my proposal is to change `setLocationBarVisible` to `setLocationBarActive` since we're activating a coordinator/mediator rather than making a UI element/view controller visible.

    File ios/chrome/browser/toolbar/coordinator/main_toolbar_mediator.h
    Line 25, Patchset 5:/// The delegate to notify about changes.
    Joemer Ramos . unresolved

    nit: to notify the mediator about changes.

    Gauthier Ambard

    I am not sure to understand. This is the mediator. Why would it notify itself?
    Updated the comment.

    Joemer Ramos

    sorry, meant to notify about changes **from** the mediator

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Gauthier Ambard
    • Ibrahim Kanouche
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
    Gerrit-Change-Number: 7726402
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Attention: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Comment-Date: Fri, 03 Apr 2026 11:56:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Joemer Ramos <joeme...@google.com>
    Comment-In-Reply-To: Gauthier Ambard <gam...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ibrahim Kanouche (Gerrit)

    unread,
    Apr 3, 2026, 3:01:05 PM (2 days ago) Apr 3
    to Gauthier Ambard, Chromium LUCI CQ, Joemer Ramos, AyeAye, chromium...@chromium.org, christia...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org
    Attention needed from Gauthier Ambard

    Ibrahim Kanouche added 2 comments

    File ios/chrome/browser/badges/ui_bundled/badge_mediator.mm
    Line 248, Patchset 5: if (visible) {
    Ibrahim Kanouche . unresolved

    When visible transitions to NO, the InfobarBadgeTabHelper still holds this mediator as its delegate. This might be an issue if the badge tab helper later calls back into this mediator while it's "invisible".

    Can we add an else branch where we call SetDelegate(nil) and clear badges?

    Gauthier Ambard

    We don't know if we are still the delegate or not when set to NO.
    I have protected the callback to return early if not active.

    Ibrahim Kanouche

    Ack.

    One question: in the setWebState: path, if visible == NO and the web state changes, the old web state's tab helper retains this mediator as delegate without cleanup. The early return guard prevents misbehavior, but is it guaranteed that the other (visible) mediator always sets itself as delegate on that same web state, effectively overwriting the stale reference? If so, this is fine. Just want to confirm there's no case where the old web state's helper holds a dangling delegate that never gets overwritten.

    Line 248, Patchset 5: if (visible) {
    Ibrahim Kanouche . resolved

    nit: When becoming invisible, should the consumer also be notified to clear its displayed badges? Currently the consumer retains whatever badge state it had when this mediator was last visible. I am thinking if the UI for the hidden toolbar is still technically alive (just not the active one), it could display stale badges when it becomes visible again before `updateBadgesShownForWebState` runs.

    Gauthier Ambard

    I think it is fine?
    In the sense that some other badges are not done through the badge tab helper, so we can't really fix all of them.
    Also, if we display them before re-calling this method, it means the new badges won't be displayed.

    Ibrahim Kanouche

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Gauthier Ambard
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I4e5abb2649c76652a13e5e9bb0021933a91f9bfa
    Gerrit-Change-Number: 7726402
    Gerrit-PatchSet: 8
    Gerrit-Owner: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Reviewer: Ibrahim Kanouche <kano...@google.com>
    Gerrit-Reviewer: Joemer Ramos <joeme...@google.com>
    Gerrit-Attention: Gauthier Ambard <gam...@chromium.org>
    Gerrit-Comment-Date: Fri, 03 Apr 2026 19:00:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ibrahim Kanouche <kano...@google.com>
    Comment-In-Reply-To: Gauthier Ambard <gam...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages