Chromium Code Reviews| 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..be0c4ab7063bc1c26017b96f46bdfa294fd6202d 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,20 @@ NewAvatarButton::~NewAvatarButton() { |
| error->RemoveObserver(this); |
| } |
| +bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) { |
| + // Prevent the avatar bubble being re-shown on release if already showing. |
|
msw
2014/08/21 19:57:44
nit: "Prevent the bubble from being re-shown if it
Mike Lerman
2014/08/21 20:02:32
Done.
|
| + suppress_mouse_released_action_ = ProfileChooserView::IsShowing(); |
| + return MenuButton::OnMousePressed(event); |
| +} |
| + |
| +void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) { |
| + if (suppress_mouse_released_action_) { |
|
msw
2014/08/21 19:57:44
nit: remove curly braces for this if/else.
Mike Lerman
2014/08/21 20:02:32
Done.
|
| + suppress_mouse_released_action_ = false; |
| + } else { |
| + MenuButton::OnMouseReleased(event); |
| + } |
| +} |
| + |
| void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { |
| UpdateAvatarButtonAndRelayoutParent(); |
| } |