Index: chrome/browser/ui/views/profiles/profile_chooser_view.cc |
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
index 5018e8e2f8c96ceb857cb6ca3029bbee1f3a8659..4e6934ba748382410fffb8ae4987eabdd48812b8 100644 |
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc |
@@ -75,7 +75,6 @@ |
#include "ui/views/controls/button/label_button.h" |
#include "ui/views/controls/button/label_button_border.h" |
#include "ui/views/controls/button/md_text_button.h" |
-#include "ui/views/controls/button/menu_button.h" |
#include "ui/views/controls/label.h" |
#include "ui/views/controls/link.h" |
#include "ui/views/controls/separator.h" |
@@ -517,7 +516,7 @@ void ProfileChooserView::ShowBubble( |
profiles::TutorialMode tutorial_mode, |
const signin::ManageAccountsParams& manage_accounts_params, |
signin_metrics::AccessPoint access_point, |
- views::View* anchor_view, |
+ views::MenuButton* calling_button, |
Browser* browser, |
bool is_source_keyboard) { |
if (IsShowing()) { |
@@ -529,7 +528,7 @@ void ProfileChooserView::ShowBubble( |
} |
profile_bubble_ = |
- new ProfileChooserView(anchor_view, browser, view_mode, tutorial_mode, |
+ new ProfileChooserView(calling_button, browser, view_mode, tutorial_mode, |
manage_accounts_params.service_type, access_point); |
views::Widget* widget = |
views::BubbleDialogDelegateView::CreateBubble(profile_bubble_); |
@@ -551,13 +550,14 @@ void ProfileChooserView::Hide() { |
profile_bubble_->GetWidget()->Close(); |
} |
-ProfileChooserView::ProfileChooserView(views::View* anchor_view, |
+ProfileChooserView::ProfileChooserView(views::MenuButton* calling_button, |
Browser* browser, |
profiles::BubbleViewMode view_mode, |
profiles::TutorialMode tutorial_mode, |
signin::GAIAServiceType service_type, |
signin_metrics::AccessPoint access_point) |
- : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
+ : BubbleDialogDelegateView(calling_button, views::BubbleBorder::TOP_RIGHT), |
+ calling_button_(calling_button), |
browser_(browser), |
view_mode_(view_mode), |
tutorial_mode_(tutorial_mode), |
@@ -641,6 +641,23 @@ void ProfileChooserView::Init() { |
ShowViewFromMode(view_mode_); |
} |
+// static |
+void ProfileChooserView::MakeCallingButtonPressedIfShowing( |
Evan Stade
2017/04/27 01:30:55
it would be easier to review this patch if it didn
emx
2017/04/27 16:30:59
OK, I'm creating a new CL without this.
|
+ const ui::Event* click_event) { |
+ if (ProfileChooserView::IsShowing()) { |
+ profile_bubble_->MakeCallingButtonPressed(click_event); |
+ } |
+} |
+ |
+void ProfileChooserView::MakeCallingButtonPressed( |
+ const ui::Event* click_event) { |
+ // Keep the avatar button "pressed" while the profile chooser is open |
+ if (calling_button_) { |
+ pressed_lock_.reset(new views::MenuButton::PressedLock( |
+ calling_button_, false, ui::LocatedEvent::FromIfValid(click_event))); |
+ } |
+} |
+ |
void ProfileChooserView::OnNativeThemeChanged( |
const ui::NativeTheme* native_theme) { |
views::BubbleDialogDelegateView::OnNativeThemeChanged(native_theme); |