| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 67 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 68 if (button_style == THEMED_BUTTON) { | 68 if (button_style == THEMED_BUTTON) { |
| 69 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); | 69 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); |
| 70 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); | 70 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); |
| 71 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); | 71 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); |
| 72 | 72 |
| 73 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | 73 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); |
| 74 generic_avatar_ = | 74 generic_avatar_ = |
| 75 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); | 75 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); |
| 76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 77 } else if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 77 } else if (base::win::GetVersion() >= base::win::VERSION_WIN8 || |
| 78 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 78 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_NORMAL); | 79 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_NORMAL); |
| 79 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_HOVER); | 80 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_HOVER); |
| 80 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_PRESSED); | 81 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_METRO_BUTTON_PRESSED); |
| 81 | 82 |
| 82 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); | 83 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); |
| 83 generic_avatar_ = | 84 generic_avatar_ = |
| 84 *rb->GetImageNamed(IDR_AVATAR_METRO_BUTTON_AVATAR).ToImageSkia(); | 85 *rb->GetImageNamed(IDR_AVATAR_METRO_BUTTON_AVATAR).ToImageSkia(); |
| 85 #endif | 86 #endif |
| 86 } else { | 87 } else { |
| 87 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_NORMAL); | 88 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_GLASS_BUTTON_NORMAL); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const int kDefaultImageTextSpacing = 5; | 204 const int kDefaultImageTextSpacing = 5; |
| 204 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); | 205 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); |
| 205 | 206 |
| 206 InvalidateLayout(); | 207 InvalidateLayout(); |
| 207 | 208 |
| 208 // 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 |
| 209 // frame needs to recalculate the button bounds and redraw it. | 210 // frame needs to recalculate the button bounds and redraw it. |
| 210 if (parent()) | 211 if (parent()) |
| 211 parent()->Layout(); | 212 parent()->Layout(); |
| 212 } | 213 } |
| OLD | NEW |