Commit 86df428a authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

ProfileMenuViewBase: Remove anchor_rect and parent_window

ProfileMenuViewBase (and its subclasses ProfileChooserView and
IncognitoMenuView) provied two options for positioning: Either via an
|anchor_button| or via an |anchor_rect| plus |parent_window|. However,
in practice, only the first option is ever used, so this CL removes the
always-empty |anchor_rect| and |parent_window| params.

Bug: none
Change-Id: I78eb148a19e6f5212428184dae99934ccd389464
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1621178
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662123}
parent 1c03e96e
...@@ -2997,9 +2997,9 @@ void BrowserView::ShowAvatarBubbleFromAvatarButton( ...@@ -2997,9 +2997,9 @@ void BrowserView::ShowAvatarBubbleFromAvatarButton(
return; return;
} }
#endif #endif
ProfileMenuViewBase::ShowBubble( ProfileMenuViewBase::ShowBubble(bubble_view_mode, manage_accounts_params,
bubble_view_mode, manage_accounts_params, access_point, avatar_button, access_point, avatar_button, browser(),
nullptr, gfx::Rect(), browser(), focus_first_profile_button); focus_first_profile_button);
ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
} }
......
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
IncognitoMenuView::IncognitoMenuView(views::Button* anchor_button, IncognitoMenuView::IncognitoMenuView(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser) Browser* browser)
: ProfileMenuViewBase(anchor_button, anchor_rect, parent_window, browser) { : ProfileMenuViewBase(anchor_button, browser) {
DCHECK(browser->profile()->IsIncognitoProfile()); DCHECK(browser->profile()->IsIncognitoProfile());
GetViewAccessibility().OverrideName(GetAccessibleWindowTitle()); GetViewAccessibility().OverrideName(GetAccessibleWindowTitle());
......
...@@ -23,8 +23,6 @@ class Browser; ...@@ -23,8 +23,6 @@ class Browser;
class IncognitoMenuView : public ProfileMenuViewBase { class IncognitoMenuView : public ProfileMenuViewBase {
public: public:
IncognitoMenuView(views::Button* anchor_button, IncognitoMenuView(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser); Browser* browser);
~IncognitoMenuView() override; ~IncognitoMenuView() override;
......
...@@ -123,13 +123,11 @@ gfx::ImageSkia GetGoogleIconForUserMenu(int icon_size) { ...@@ -123,13 +123,11 @@ gfx::ImageSkia GetGoogleIconForUserMenu(int icon_size) {
bool ProfileChooserView::close_on_deactivate_for_testing_ = true; bool ProfileChooserView::close_on_deactivate_for_testing_ = true;
ProfileChooserView::ProfileChooserView(views::Button* anchor_button, ProfileChooserView::ProfileChooserView(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser, Browser* browser,
profiles::BubbleViewMode view_mode, profiles::BubbleViewMode view_mode,
signin::GAIAServiceType service_type, signin::GAIAServiceType service_type,
signin_metrics::AccessPoint access_point) signin_metrics::AccessPoint access_point)
: ProfileMenuViewBase(anchor_button, anchor_rect, parent_window, browser), : ProfileMenuViewBase(anchor_button, browser),
view_mode_(view_mode), view_mode_(view_mode),
gaia_service_type_(service_type), gaia_service_type_(service_type),
access_point_(access_point), access_point_(access_point),
......
...@@ -38,8 +38,6 @@ class ProfileChooserView : public ProfileMenuViewBase, ...@@ -38,8 +38,6 @@ class ProfileChooserView : public ProfileMenuViewBase,
public identity::IdentityManager::Observer { public identity::IdentityManager::Observer {
public: public:
ProfileChooserView(views::Button* anchor_button, ProfileChooserView(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser, Browser* browser,
profiles::BubbleViewMode view_mode, profiles::BubbleViewMode view_mode,
signin::GAIAServiceType service_type, signin::GAIAServiceType service_type,
......
...@@ -69,8 +69,6 @@ void ProfileMenuViewBase::ShowBubble( ...@@ -69,8 +69,6 @@ void ProfileMenuViewBase::ShowBubble(
const signin::ManageAccountsParams& manage_accounts_params, const signin::ManageAccountsParams& manage_accounts_params,
signin_metrics::AccessPoint access_point, signin_metrics::AccessPoint access_point,
views::Button* anchor_button, views::Button* anchor_button,
gfx::NativeView parent_window,
const gfx::Rect& anchor_rect,
Browser* browser, Browser* browser,
bool is_source_keyboard) { bool is_source_keyboard) {
if (IsShowing()) if (IsShowing())
...@@ -81,13 +79,12 @@ void ProfileMenuViewBase::ShowBubble( ...@@ -81,13 +79,12 @@ void ProfileMenuViewBase::ShowBubble(
ProfileMenuViewBase* bubble; ProfileMenuViewBase* bubble;
if (view_mode == profiles::BUBBLE_VIEW_MODE_INCOGNITO) { if (view_mode == profiles::BUBBLE_VIEW_MODE_INCOGNITO) {
bubble = new IncognitoMenuView(anchor_button, anchor_rect, parent_window, bubble = new IncognitoMenuView(anchor_button, browser);
browser);
} else { } else {
#if !defined(OS_CHROMEOS) #if !defined(OS_CHROMEOS)
bubble = new ProfileChooserView( bubble = new ProfileChooserView(anchor_button, browser, view_mode,
anchor_button, anchor_rect, parent_window, browser, view_mode, manage_accounts_params.service_type,
manage_accounts_params.service_type, access_point); access_point);
#else #else
NOTREACHED(); NOTREACHED();
return; return;
...@@ -116,8 +113,6 @@ ProfileMenuViewBase* ProfileMenuViewBase::GetBubbleForTesting() { ...@@ -116,8 +113,6 @@ ProfileMenuViewBase* ProfileMenuViewBase::GetBubbleForTesting() {
} }
ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button, ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser) Browser* browser)
: BubbleDialogDelegateView(anchor_button, views::BubbleBorder::TOP_RIGHT), : BubbleDialogDelegateView(anchor_button, views::BubbleBorder::TOP_RIGHT),
browser_(browser), browser_(browser),
...@@ -130,13 +125,8 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button, ...@@ -130,13 +125,8 @@ ProfileMenuViewBase::ProfileMenuViewBase(views::Button* anchor_button,
// The sign in webview will be clipped on the bottom corners without these // The sign in webview will be clipped on the bottom corners without these
// margins, see related bug <http://crbug.com/593203>. // margins, see related bug <http://crbug.com/593203>.
set_margins(gfx::Insets(2, 0)); set_margins(gfx::Insets(2, 0));
if (anchor_button) { DCHECK(anchor_button);
anchor_button->AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); anchor_button->AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr);
} else {
DCHECK(parent_window);
SetAnchorRect(anchor_rect);
set_parent_window(parent_window);
}
EnableUpDownKeyboardAccelerators(); EnableUpDownKeyboardAccelerators();
GetViewAccessibility().OverrideRole(ax::mojom::Role::kMenu); GetViewAccessibility().OverrideRole(ax::mojom::Role::kMenu);
......
...@@ -74,16 +74,11 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -74,16 +74,11 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
// call this function when the button is clicked and if the bubble isn't // call this function when the button is clicked and if the bubble isn't
// showing it will appear while if it is showing, nothing will happen here and // showing it will appear while if it is showing, nothing will happen here and
// the existing bubble will auto-close due to focus loss. // the existing bubble will auto-close due to focus loss.
// There are 2 ways to position the Bubble, if |anchor_button| is set, then
// |parent_window| and |anchor_rect| are ignored. Otherwise, |parent_window|
// and |anchor_rect| have to be set.
static void ShowBubble( static void ShowBubble(
profiles::BubbleViewMode view_mode, profiles::BubbleViewMode view_mode,
const signin::ManageAccountsParams& manage_accounts_params, const signin::ManageAccountsParams& manage_accounts_params,
signin_metrics::AccessPoint access_point, signin_metrics::AccessPoint access_point,
views::Button* anchor_button, views::Button* anchor_button,
gfx::NativeView parent_window,
const gfx::Rect& anchor_rect,
Browser* browser, Browser* browser,
bool is_source_keyboard); bool is_source_keyboard);
...@@ -94,8 +89,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate, ...@@ -94,8 +89,6 @@ class ProfileMenuViewBase : public content::WebContentsDelegate,
protected: protected:
ProfileMenuViewBase(views::Button* anchor_button, ProfileMenuViewBase(views::Button* anchor_button,
const gfx::Rect& anchor_rect,
gfx::NativeView parent_window,
Browser* browser); Browser* browser);
~ProfileMenuViewBase() override; ~ProfileMenuViewBase() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment