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

Side by Side Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 1136693002: Chrome user menu shouldn't close if a tab steals focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments before LGTM Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" 5 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
6 6
7 #include "base/win/windows_version.h" 7 #include "base/win/windows_version.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/profiles/profiles_state.h" 10 #include "chrome/browser/profiles/profiles_state.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 NewAvatarButton::~NewAvatarButton() { 113 NewAvatarButton::~NewAvatarButton() {
114 g_browser_process->profile_manager()-> 114 g_browser_process->profile_manager()->
115 GetProfileInfoCache().RemoveObserver(this); 115 GetProfileInfoCache().RemoveObserver(this);
116 SigninErrorController* error = 116 SigninErrorController* error =
117 profiles::GetSigninErrorController(browser_->profile()); 117 profiles::GetSigninErrorController(browser_->profile());
118 if (error) 118 if (error)
119 error->RemoveObserver(this); 119 error->RemoveObserver(this);
120 } 120 }
121 121
122 bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) { 122 bool NewAvatarButton::OnMousePressed(const ui::MouseEvent& event) {
123 // Prevent the bubble from being re-shown if it's already showing. 123 // Prevent the bubble from being re-shown if it's already showing in current
msw 2015/05/19 22:57:48 nit: "in the current"
gogerald1 2015/05/19 23:35:13 Done.
124 suppress_mouse_released_action_ = ProfileChooserView::IsShowing(); 124 // browser and Hide it if it's showing in another browser.
125 ProfileChooserView::ShowingType show_type =
126 ProfileChooserView::IsShowingInBrowser(browser_);
127 if (show_type == ProfileChooserView::IS_SHOWING)
128 suppress_mouse_released_action_ = true;
129 else if (show_type == ProfileChooserView::IS_SHOWING_IN_ANOTHER_BROWSER)
130 ProfileChooserView::Hide();
125 return LabelButton::OnMousePressed(event); 131 return LabelButton::OnMousePressed(event);
126 } 132 }
127 133
128 void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) { 134 void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) {
129 if (suppress_mouse_released_action_) 135 if (suppress_mouse_released_action_)
130 suppress_mouse_released_action_ = false; 136 suppress_mouse_released_action_ = false;
131 else 137 else
132 LabelButton::OnMouseReleased(event); 138 LabelButton::OnMouseReleased(event);
133 } 139 }
134 140
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); 208 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia());
203 } 209 }
204 210
205 // If we are not using the generic button, then reset the spacing between 211 // If we are not using the generic button, then reset the spacing between
206 // the text and the possible authentication error icon. 212 // the text and the possible authentication error icon.
207 const int kDefaultImageTextSpacing = 5; 213 const int kDefaultImageTextSpacing = 5;
208 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); 214 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing);
209 215
210 PreferredSizeChanged(); 216 PreferredSizeChanged();
211 } 217 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698