Refactor: Finalize AppMenuControl Interface Extraction [chromium/src : main]

0 views
Skip to first unread message

Youseff Bourouphel (Gerrit)

unread,
Apr 22, 2026, 3:31:19 PM (24 hours ago) Apr 22
to Qingxin Wu, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Qingxin Wu

Youseff Bourouphel added 5 comments

Commit Message
Line 11, Patchset 5:(GetView, ExecuteCommand, GetMenuModel) to the interface and updates all
Qingxin Wu . resolved

wait, are these all only needed because of tests? If so, I don't think it's a good idea to expose them to the interface. See the other comments about whether we can use `views::ElementTrackerViews::GetInstance()->GetFirstMatchingView` with `views::AsViewClass<xxx>` in the tests, avoiding exposing these methods in the interface.

Youseff Bourouphel

Done

Line 17, Patchset 5:Change-Id: I489fb4dc51a193b6eceaf11007fa01445c0f4860
Qingxin Wu . resolved

nit: do you want to include `bug: 470045312`?

Youseff Bourouphel

updated to proper bug

File chrome/browser/ui/views/media_router/app_menu_test_api_views.cc
Line 51, Patchset 5: GetAppMenuControl()->ExecuteCommand(command);
Qingxin Wu . resolved
similarly, would the following code work?
```
auto* button = views::AsViewClass<BrowserAppMenuButton>(
views::ElementTrackerViews::GetInstance()->GetFirstMatchingView(
kToolbarAppMenuButtonElementId,
browser_->window()->GetElementContext()));
button->app_menu()->ExecuteCommand(command, 0);
```
Youseff Bourouphel

Done

File chrome/browser/ui/views/toolbar/app_menu_control.h
Line 27, Patchset 5: virtual views::View* GetView() = 0;
Qingxin Wu . resolved

Is this only used in tests? if so, can we get rid of it, like using views::ElementTrackerViews::GetInstance()->GetFirstMatchingView()? See https://chromium-review.git.corp.google.com/c/chromium/src/+/7705932/comment/6ac80970_91019625/.
By using it, the test doesn't need to know where the button lives or how to access its specific C++ getter, it just asks the tracker for "the app menu button" in the current context. When the WebUI Toolbar replaces the native views toolbar, the WebUI app menu button will also need to be tagged with kToolbarAppMenuButtonElementId. Tests using ElementTracker will be much easier to migrate (or simply just work). Remember to include new headers and remove no longer needed headers if changing to it.
If it does not work for your case, we can rename this to GetViewForTest (if it's indeed only used in test)

Youseff Bourouphel

removed the test only methods

File chrome/browser/ui/views/toolbar/browser_app_menu_button_interactive_uitest.cc
Line 84, Patchset 5: auto* model = toolbar->GetAppMenuControl()->GetMenuModel();
Qingxin Wu . resolved
Would the following code work instead?
```
auto* button = views::AsViewClass<BrowserAppMenuButton>(
views::ElementTrackerViews::GetInstance()->GetFirstMatchingView(
kToolbarAppMenuButtonElementId,
browser()->window()->GetElementContext()));
auto* model = button->app_menu_model();
```
Youseff Bourouphel

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Qingxin Wu
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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
Gerrit-Change-Number: 7782764
Gerrit-PatchSet: 9
Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
Gerrit-Attention: Qingxin Wu <qing...@google.com>
Gerrit-Comment-Date: Wed, 22 Apr 2026 19:31:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Qingxin Wu <qing...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Qingxin Wu (Gerrit)

unread,
Apr 22, 2026, 7:41:24 PM (19 hours ago) Apr 22
to Youseff Bourouphel, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Youseff Bourouphel

Qingxin Wu added 7 comments

File chrome/browser/ui/desktop_to_mobile_promos/ios_promos_utils.cc
Line 105, Patchset 11 (Latest): {toolbar_button_provider->GetAppMenuControl()->GetAnchor()},
Qingxin Wu . unresolved

Include What You Use.
Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"
(also suggested the same in a few other places. Double chedck if you can remove browser_app_menu_button.h in those places)

File chrome/browser/ui/toolbar/app_menu_icon_controller.cc
Line 170, Patchset 11 (Latest):#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && \
(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
Qingxin Wu . unresolved

let's just revert to what it was on the left side?

Line 183, Patchset 11 (Latest):#else
Qingxin Wu . unresolved

is this change intentional?

File chrome/browser/ui/views/promos/ios_promo_bubble_interactive_uitest.cc
Line 123, Patchset 11 (Latest): anchor = browser_view->toolbar()->GetAppMenuControl()->GetAnchor();
Qingxin Wu . unresolved

Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

File chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_controller_browsertest.cc
Line 204, Patchset 11 (Latest): EXPECT_TRUE(toolbar->GetAppMenuControl()->IsDrawn());
Qingxin Wu . unresolved

Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

File chrome/browser/ui/views/toolbar/browser_app_menu_button_interactive_uitest_chromeos.cc
Line 111, Patchset 11 (Latest): ->GetAppMenuControl()
Qingxin Wu . unresolved

Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

File chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc
Line 62, Patchset 11 (Parent): ->app_menu_button());
Qingxin Wu . unresolved

see if this is the only place that needs "chrome/browser/ui/views/toolbar/browser_app_menu_button.h". If so, remove the include.
Check other test files as well to see if they can also remove the include.

Open in Gerrit

Related details

Attention is currently required from:
  • Youseff Bourouphel
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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
    Gerrit-Change-Number: 7782764
    Gerrit-PatchSet: 11
    Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
    Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
    Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
    Gerrit-Attention: Youseff Bourouphel <ybouro...@google.com>
    Gerrit-Comment-Date: Wed, 22 Apr 2026 23:41:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Qingxin Wu (Gerrit)

    unread,
    Apr 22, 2026, 7:45:33 PM (19 hours ago) Apr 22
    to Youseff Bourouphel, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
    Attention needed from Youseff Bourouphel

    Qingxin Wu voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Youseff Bourouphel
    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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
      Gerrit-Change-Number: 7782764
      Gerrit-PatchSet: 11
      Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
      Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
      Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
      Gerrit-Attention: Youseff Bourouphel <ybouro...@google.com>
      Gerrit-Comment-Date: Wed, 22 Apr 2026 23:45:26 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Youseff Bourouphel (Gerrit)

      unread,
      10:40 AM (4 hours ago) 10:40 AM
      to Qingxin Wu, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org

      Youseff Bourouphel added 7 comments

      File chrome/browser/ui/desktop_to_mobile_promos/ios_promos_utils.cc
      Line 105, Patchset 11: {toolbar_button_provider->GetAppMenuControl()->GetAnchor()},
      Qingxin Wu . resolved

      Include What You Use.
      Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"
      (also suggested the same in a few other places. Double chedck if you can remove browser_app_menu_button.h in those places)

      Youseff Bourouphel

      Done

      File chrome/browser/ui/toolbar/app_menu_icon_controller.cc
      Line 170, Patchset 11:#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && \
      (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
      Qingxin Wu . resolved

      let's just revert to what it was on the left side?

      Youseff Bourouphel

      Done

      Line 183, Patchset 11:#else
      Qingxin Wu . resolved

      is this change intentional?

      Youseff Bourouphel

      yeah, this else is also in the original. I now updated so they more clearly match.

      File chrome/browser/ui/views/promos/ios_promo_bubble_interactive_uitest.cc
      Line 123, Patchset 11: anchor = browser_view->toolbar()->GetAppMenuControl()->GetAnchor();
      Qingxin Wu . resolved

      Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

      Youseff Bourouphel

      Done

      File chrome/browser/ui/views/tabs/vertical/vertical_tab_strip_controller_browsertest.cc
      Line 204, Patchset 11: EXPECT_TRUE(toolbar->GetAppMenuControl()->IsDrawn());
      Qingxin Wu . resolved

      Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

      Youseff Bourouphel

      Done

      File chrome/browser/ui/views/toolbar/browser_app_menu_button_interactive_uitest_chromeos.cc
      Line 111, Patchset 11: ->GetAppMenuControl()
      Qingxin Wu . resolved

      Remove #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h", and add #include "chrome/browser/ui/views/toolbar/app_menu_control.h"

      Youseff Bourouphel

      Done

      File chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc
      Line 62, Patchset 11 (Parent): ->app_menu_button());
      Qingxin Wu . resolved

      see if this is the only place that needs "chrome/browser/ui/views/toolbar/browser_app_menu_button.h". If so, remove the include.
      Check other test files as well to see if they can also remove the include.

      Youseff Bourouphel

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • 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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
        Gerrit-Change-Number: 7782764
        Gerrit-PatchSet: 12
        Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
        Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
        Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
        Gerrit-Comment-Date: Thu, 23 Apr 2026 14:40:17 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Qingxin Wu <qing...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Qingxin Wu (Gerrit)

        unread,
        11:27 AM (4 hours ago) 11:27 AM
        to Youseff Bourouphel, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
        Attention needed from Youseff Bourouphel

        Qingxin Wu voted and added 1 comment

        Votes added by Qingxin Wu

        Code-Review+1

        1 comment

        File chrome/browser/ui/views/toolbar/toolbar_view.h
        Line 287, Patchset 12 (Parent): AppMenuControl* GetAppMenuControl() override;
        Qingxin Wu . unresolved

        was it intentional to move this up? It's still an override of ToolbarButtonProvider, right?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Youseff Bourouphel
        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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
          Gerrit-Change-Number: 7782764
          Gerrit-PatchSet: 12
          Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
          Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
          Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
          Gerrit-Attention: Youseff Bourouphel <ybouro...@google.com>
          Gerrit-Comment-Date: Thu, 23 Apr 2026 15:27:27 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Youseff Bourouphel (Gerrit)

          unread,
          1:14 PM (2 hours ago) 1:14 PM
          to Qingxin Wu, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
          Attention needed from Qingxin Wu

          Youseff Bourouphel added 1 comment

          File chrome/browser/ui/views/toolbar/toolbar_view.h
          Line 287, Patchset 12 (Parent): AppMenuControl* GetAppMenuControl() override;
          Qingxin Wu . resolved

          was it intentional to move this up? It's still an override of ToolbarButtonProvider, right?

          Youseff Bourouphel

          fixed, i had made it public but found a way to not to have to.

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Qingxin Wu
          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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
            Gerrit-Change-Number: 7782764
            Gerrit-PatchSet: 13
            Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
            Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
            Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
            Gerrit-Attention: Qingxin Wu <qing...@google.com>
            Gerrit-Comment-Date: Thu, 23 Apr 2026 17:14:48 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Qingxin Wu (Gerrit)

            unread,
            1:32 PM (2 hours ago) 1:32 PM
            to Youseff Bourouphel, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org
            Attention needed from Youseff Bourouphel

            Qingxin Wu voted and added 1 comment

            Votes added by Qingxin Wu

            Code-Review+1

            1 comment

            File chrome/browser/ui/toolbar/app_menu_icon_controller.cc
            Line 195, Patchset 13 (Latest): Severity severity) {
            Qingxin Wu . unresolved

            not used

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Youseff Bourouphel
            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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
              Gerrit-Change-Number: 7782764
              Gerrit-PatchSet: 13
              Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
              Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
              Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
              Gerrit-Attention: Youseff Bourouphel <ybouro...@google.com>
              Gerrit-Comment-Date: Thu, 23 Apr 2026 17:32:47 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Youseff Bourouphel (Gerrit)

              unread,
              1:51 PM (1 hour ago) 1:51 PM
              to Qingxin Wu, Chromium LUCI CQ, chromium...@chromium.org, dfried...@chromium.org, estali...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org, mfoltz+wa...@chromium.org

              Youseff Bourouphel added 1 comment

              File chrome/browser/ui/toolbar/app_menu_icon_controller.cc
              Line 195, Patchset 13: Severity severity) {
              Qingxin Wu . resolved

              not used

              Youseff Bourouphel

              Done

              Open in Gerrit

              Related details

              Attention set is empty
              Submit Requirements:
                • requirement satisfiedCode-Coverage
                • requirement is not satisfiedCode-Owners
                • requirement satisfiedCode-Review
                • 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: I489fb4dc51a193b6eceaf11007fa01445c0f4860
                Gerrit-Change-Number: 7782764
                Gerrit-PatchSet: 14
                Gerrit-Owner: Youseff Bourouphel <ybouro...@google.com>
                Gerrit-Reviewer: Qingxin Wu <qing...@google.com>
                Gerrit-Reviewer: Youseff Bourouphel <ybouro...@google.com>
                Gerrit-Comment-Date: Thu, 23 Apr 2026 17:50:56 +0000
                satisfied_requirement
                unsatisfied_requirement
                open
                diffy
                Reply all
                Reply to author
                Forward
                0 new messages