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" | |
10 #include "build/build_config.h" | 9 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/profiles/profiles_state.h" | 12 #include "chrome/browser/profiles/profiles_state.h" |
14 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 14 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
16 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
17 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/gfx/canvas.h" | 17 #include "ui/gfx/canvas.h" |
19 #include "ui/gfx/color_palette.h" | 18 #include "ui/gfx/color_palette.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 | 72 |
74 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 73 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
75 if (button_style == THEMED_BUTTON) { | 74 if (button_style == THEMED_BUTTON) { |
76 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); | 75 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); |
77 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); | 76 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); |
78 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); | 77 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); |
79 | 78 |
80 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | 79 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); |
81 generic_avatar_ = | 80 generic_avatar_ = |
82 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); | 81 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); |
83 #if defined(OS_WIN) | |
84 } else if (base::win::GetVersion() >= base::win::VERSION_WIN8 || | |
tapted
2016/01/25 21:23:25
Argh. This is an `||` not an `&&`. What a trap. I
| |
85 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { | |
86 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_NORMAL); | |
87 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_HOVER); | |
88 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_PRESSED); | |
89 | |
90 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | |
91 generic_avatar_ = | |
92 *rb->GetImageNamed(IDR_AVATAR_METRO_BUTTON_AVATAR).ToImageSkia(); | |
93 #endif | |
94 } else { | 82 } else { |
95 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_NORMAL); | 83 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_NORMAL); |
96 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_HOVER); | 84 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_HOVER); |
97 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_PRESSED); | 85 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_PRESSED); |
98 | 86 |
99 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | 87 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); |
100 generic_avatar_ = | 88 generic_avatar_ = |
101 *rb->GetImageNamed(IDR_AVATAR_GLASS_BUTTON_AVATAR).ToImageSkia(); | 89 *rb->GetImageNamed(IDR_AVATAR_GLASS_BUTTON_AVATAR).ToImageSkia(); |
102 } | 90 } |
103 | 91 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); | 207 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); |
220 } | 208 } |
221 | 209 |
222 // If we are not using the generic button, then reset the spacing between | 210 // If we are not using the generic button, then reset the spacing between |
223 // the text and the possible authentication error icon. | 211 // the text and the possible authentication error icon. |
224 const int kDefaultImageTextSpacing = 5; | 212 const int kDefaultImageTextSpacing = 5; |
225 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 213 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
226 | 214 |
227 PreferredSizeChanged(); | 215 PreferredSizeChanged(); |
228 } | 216 } |
OLD | NEW |