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