| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); | 63 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON); |
| 64 set_animate_on_state_change(false); | 64 set_animate_on_state_change(false); |
| 65 SetEnabledTextColors(SK_ColorWHITE); | 65 SetEnabledTextColors(SK_ColorWHITE); |
| 66 SetTextSubpixelRenderingEnabled(false); | 66 SetTextSubpixelRenderingEnabled(false); |
| 67 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 67 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 68 | 68 |
| 69 // The largest text height that fits in the button. If the font list height | 69 // The largest text height that fits in the button. If the font list height |
| 70 // is larger than this, it will be shrunk to match it. | 70 // is larger than this, it will be shrunk to match it. |
| 71 // TODO(noms): Calculate this constant algorithmically from the button's size. | 71 // TODO(noms): Calculate this constant algorithmically from the button's size. |
| 72 const int kDisplayFontHeight = 16; | 72 const int kDisplayFontHeight = 16; |
| 73 SetFontList(GetFontList().DeriveWithHeightUpperBound(kDisplayFontHeight)); | 73 SetFontList( |
| 74 label()->font_list().DeriveWithHeightUpperBound(kDisplayFontHeight)); |
| 74 | 75 |
| 75 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 76 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 76 if (button_style == AvatarButtonStyle::THEMED) { | 77 if (button_style == AvatarButtonStyle::THEMED) { |
| 77 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); | 78 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); |
| 78 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); | 79 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); |
| 79 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); | 80 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); |
| 80 | 81 |
| 81 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | 82 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); |
| 82 generic_avatar_ = | 83 generic_avatar_ = |
| 83 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); | 84 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 211 } |
| 211 | 212 |
| 212 // If we are not using the generic button, then reset the spacing between | 213 // If we are not using the generic button, then reset the spacing between |
| 213 // the text and the possible authentication error icon. | 214 // the text and the possible authentication error icon. |
| 214 const int kDefaultImageTextSpacing = 5; | 215 const int kDefaultImageTextSpacing = 5; |
| 215 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 216 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
| 216 | 217 |
| 217 PreferredSizeChanged(); | 218 PreferredSizeChanged(); |
| 218 delegate_->ButtonPreferredSizeChanged(); | 219 delegate_->ButtonPreferredSizeChanged(); |
| 219 } | 220 } |
| OLD | NEW |