Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3511)

Unified Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 488253002: Avatar Bubble doesn't re-pop when trying to click it away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: msw nits Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/profiles/new_avatar_button.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2fe40aeee147f1612ef61422bf167076532527ee 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,19 @@ NewAvatarButton::~NewAvatarButton() {
error->RemoveObserver(this);
}
+bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) {
+ // Prevent the bubble from being re-shown if it's already showing.
+ suppress_mouse_released_action_ = ProfileChooserView::IsShowing();
+ return MenuButton::OnMousePressed(event);
+}
+
+void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) {
+ if (suppress_mouse_released_action_)
+ suppress_mouse_released_action_ = false;
+ else
+ MenuButton::OnMouseReleased(event);
+}
+
void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) {
UpdateAvatarButtonAndRelayoutParent();
}
« no previous file with comments | « chrome/browser/ui/views/profiles/new_avatar_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698