| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 NewAvatarButton::NewAvatarButton(views::ButtonListener* listener, | 45 NewAvatarButton::NewAvatarButton(views::ButtonListener* listener, |
| 46 AvatarButtonStyle button_style, | 46 AvatarButtonStyle button_style, |
| 47 Browser* browser) | 47 Browser* browser) |
| 48 : LabelButton(listener, base::string16()), | 48 : LabelButton(listener, base::string16()), |
| 49 browser_(browser), | 49 browser_(browser), |
| 50 has_auth_error_(false), | 50 has_auth_error_(false), |
| 51 suppress_mouse_released_action_(false) { | 51 suppress_mouse_released_action_(false) { |
| 52 set_triggerable_event_flags( |
| 53 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); |
| 52 set_animate_on_state_change(false); | 54 set_animate_on_state_change(false); |
| 53 SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE); | 55 SetTextColor(views::Button::STATE_NORMAL, SK_ColorWHITE); |
| 54 SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE); | 56 SetTextColor(views::Button::STATE_HOVERED, SK_ColorWHITE); |
| 55 SetTextColor(views::Button::STATE_PRESSED, SK_ColorWHITE); | 57 SetTextColor(views::Button::STATE_PRESSED, SK_ColorWHITE); |
| 56 SetTextSubpixelRenderingEnabled(false); | 58 SetTextSubpixelRenderingEnabled(false); |
| 57 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 59 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 58 | 60 |
| 59 // The largest text height that fits in the button. If the font list height | 61 // The largest text height that fits in the button. If the font list height |
| 60 // is larger than this, it will be shrunk to match it. | 62 // is larger than this, it will be shrunk to match it. |
| 61 // TODO(noms): Calculate this constant algorithmically from the button's size. | 63 // TODO(noms): Calculate this constant algorithmically from the button's size. |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const int kDefaultImageTextSpacing = 5; | 204 const int kDefaultImageTextSpacing = 5; |
| 203 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 205 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
| 204 | 206 |
| 205 InvalidateLayout(); | 207 InvalidateLayout(); |
| 206 | 208 |
| 207 // Because the width of the button might have changed, the parent browser | 209 // Because the width of the button might have changed, the parent browser |
| 208 // frame needs to recalculate the button bounds and redraw it. | 210 // frame needs to recalculate the button bounds and redraw it. |
| 209 if (parent()) | 211 if (parent()) |
| 210 parent()->Layout(); | 212 parent()->Layout(); |
| 211 } | 213 } |
| OLD | NEW |