OLD | NEW |
---|---|
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 Loading... | |
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 if (ProfileChooserView::IsShowing()) |
124 suppress_mouse_released_action_ = ProfileChooserView::IsShowing(); | 124 ProfileChooserView::Hide(); |
Roger Tawa OOO till Jul 10th
2015/05/08 14:51:17
If the member |suppress_mouse_released_action_| is
| |
125 return LabelButton::OnMousePressed(event); | 125 return LabelButton::OnMousePressed(event); |
126 } | 126 } |
127 | 127 |
128 void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) { | 128 void NewAvatarButton::OnMouseReleased(const ui::MouseEvent& event) { |
129 if (suppress_mouse_released_action_) | |
130 suppress_mouse_released_action_ = false; | |
131 else | |
132 LabelButton::OnMouseReleased(event); | 129 LabelButton::OnMouseReleased(event); |
133 } | 130 } |
134 | 131 |
135 void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { | 132 void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { |
136 Update(); | 133 Update(); |
137 } | 134 } |
138 | 135 |
139 void NewAvatarButton::OnProfileWasRemoved( | 136 void NewAvatarButton::OnProfileWasRemoved( |
140 const base::FilePath& profile_path, | 137 const base::FilePath& profile_path, |
141 const base::string16& profile_name) { | 138 const base::string16& profile_name) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 199 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
203 } | 200 } |
204 | 201 |
205 // If we are not using the generic button, then reset the spacing between | 202 // If we are not using the generic button, then reset the spacing between |
206 // the text and the possible authentication error icon. | 203 // the text and the possible authentication error icon. |
207 const int kDefaultImageTextSpacing = 5; | 204 const int kDefaultImageTextSpacing = 5; |
208 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 205 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
209 | 206 |
210 PreferredSizeChanged(); | 207 PreferredSizeChanged(); |
211 } | 208 } |
OLD | NEW |