Index: chrome/browser/ui/views/profiles/new_avatar_button.cc |
diff --git a/chrome/browser/ui/views/profiles/new_avatar_button.cc b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
index 99a62030508db329d3e8417a9fcc0b35cf0dbeee..df360ac8075c4759e6f22d91566a47aa6fc1ef5c 100644 |
--- a/chrome/browser/ui/views/profiles/new_avatar_button.cc |
+++ b/chrome/browser/ui/views/profiles/new_avatar_button.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/profiles/profiles_state.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
#include "grit/theme_resources.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/canvas.h" |
@@ -50,7 +51,8 @@ NewAvatarButton::NewAvatarButton( |
profiles::GetAvatarButtonTextForProfile(browser->profile()), |
NULL, |
true), |
- browser_(browser) { |
+ browser_(browser), |
+ suppress_mouse_released_action_(false) { |
set_animate_on_state_change(false); |
SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE); |
SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE); |
@@ -111,6 +113,24 @@ NewAvatarButton::~NewAvatarButton() { |
error->RemoveObserver(this); |
} |
+bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) { |
+ // If the avatar bubble is showing then don't reshow it when the mouse is |
msw
2014/08/20 21:12:36
nit: aim for one-liners, like "Prevent the bubble
Mike Lerman
2014/08/21 15:15:36
Done.
|
+ // released. |
+ suppress_mouse_released_action_ = ProfileChooserView::IsShowing(); |
+ |
+ // We want to show the avatar bubble on mouse release; that is the standard |
+ // behavior for buttons. |
+ return true; |
msw
2014/08/20 21:12:36
Return MenuButton::OnMousePressed. Remove comment
Mike Lerman
2014/08/21 15:15:36
Done.
|
+} |
+ |
+bool NewAvatarButton::IsMouseReleaseActionSuppressed() { |
msw
2014/08/20 21:12:36
Remove this and instead override NewAvatarButton::
Mike Lerman
2014/08/21 15:15:36
That is much cleaner. I didn't imagine swallowing
|
+ if (suppress_mouse_released_action_) { |
+ suppress_mouse_released_action_ = false; |
+ return true; |
+ } |
+ return false; |
+} |
+ |
void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { |
UpdateAvatarButtonAndRelayoutParent(); |
} |