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

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: 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
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();
}

Powered by Google App Engine
This is Rietveld 408576698