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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_) | 129 if (suppress_mouse_released_action_) |
130 suppress_mouse_released_action_ = false; | 130 suppress_mouse_released_action_ = false; |
131 else | 131 else |
132 LabelButton::OnMouseReleased(event); | 132 LabelButton::OnMouseReleased(event); |
133 } | 133 } |
134 | 134 |
| 135 void NewAvatarButton::OnGestureEvent(ui::GestureEvent* event) { |
| 136 // TODO(wjmaclean): The check for ET_GESTURE_LONG_PRESS is done here since |
| 137 // no other UI button based on CustomButton appears to handle mouse |
| 138 // right-click. If other cases are identified, it may make sense to move this |
| 139 // check to CustomButton. |
| 140 if (event->type() == ui::ET_GESTURE_LONG_PRESS) |
| 141 NotifyClick(*event); |
| 142 else |
| 143 LabelButton::OnGestureEvent(event); |
| 144 } |
| 145 |
135 void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { | 146 void NewAvatarButton::OnProfileAdded(const base::FilePath& profile_path) { |
136 Update(); | 147 Update(); |
137 } | 148 } |
138 | 149 |
139 void NewAvatarButton::OnProfileWasRemoved( | 150 void NewAvatarButton::OnProfileWasRemoved( |
140 const base::FilePath& profile_path, | 151 const base::FilePath& profile_path, |
141 const base::string16& profile_name) { | 152 const base::string16& profile_name) { |
142 // If deleting the active profile, don't bother updating the avatar | 153 // If deleting the active profile, don't bother updating the avatar |
143 // button, as the browser window is being closed anyway. | 154 // button, as the browser window is being closed anyway. |
144 if (browser_->profile()->GetPath() != profile_path) | 155 if (browser_->profile()->GetPath() != profile_path) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 213 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
203 } | 214 } |
204 | 215 |
205 // If we are not using the generic button, then reset the spacing between | 216 // If we are not using the generic button, then reset the spacing between |
206 // the text and the possible authentication error icon. | 217 // the text and the possible authentication error icon. |
207 const int kDefaultImageTextSpacing = 5; | 218 const int kDefaultImageTextSpacing = 5; |
208 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 219 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
209 | 220 |
210 PreferredSizeChanged(); | 221 PreferredSizeChanged(); |
211 } | 222 } |
OLD | NEW |