Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/ui/views/profiles/new_avatar_button.cc

Issue 1608843002: Start untangling the avatar switcher from BrowserNonClientFrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160119-MacViewsBrowser-Compile
Patch Set: rename, enum class Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 SetTextSubpixelRenderingEnabled(false); 65 SetTextSubpixelRenderingEnabled(false);
66 SetHorizontalAlignment(gfx::ALIGN_CENTER); 66 SetHorizontalAlignment(gfx::ALIGN_CENTER);
67 67
68 // The largest text height that fits in the button. If the font list height 68 // The largest text height that fits in the button. If the font list height
69 // is larger than this, it will be shrunk to match it. 69 // is larger than this, it will be shrunk to match it.
70 // TODO(noms): Calculate this constant algorithmically from the button's size. 70 // TODO(noms): Calculate this constant algorithmically from the button's size.
71 const int kDisplayFontHeight = 16; 71 const int kDisplayFontHeight = 16;
72 SetFontList(GetFontList().DeriveWithHeightUpperBound(kDisplayFontHeight)); 72 SetFontList(GetFontList().DeriveWithHeightUpperBound(kDisplayFontHeight));
73 73
74 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 74 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
75 if (button_style == THEMED_BUTTON) { 75 if (button_style == AvatarButtonStyle::THEMED) {
76 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL); 76 const int kNormalImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_NORMAL);
77 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER); 77 const int kHotImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_HOVER);
78 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED); 78 const int kPushedImageSet[] = IMAGE_GRID(IDR_AVATAR_THEMED_BUTTON_PRESSED);
79 79
80 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet)); 80 SetBorder(CreateBorder(kNormalImageSet, kHotImageSet, kPushedImageSet));
81 generic_avatar_ = 81 generic_avatar_ =
82 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia(); 82 *rb->GetImageNamed(IDR_AVATAR_THEMED_BUTTON_AVATAR).ToImageSkia();
83 #if defined(OS_WIN) 83 #if defined(OS_WIN)
84 } else if (base::win::GetVersion() >= base::win::VERSION_WIN8 || 84 } else if (base::win::GetVersion() >= base::win::VERSION_WIN8 ||
85 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) { 85 browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia()); 219 SetImage(views::Button::STATE_NORMAL, gfx::ImageSkia());
220 } 220 }
221 221
222 // 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
223 // the text and the possible authentication error icon. 223 // the text and the possible authentication error icon.
224 const int kDefaultImageTextSpacing = 5; 224 const int kDefaultImageTextSpacing = 5;
225 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing); 225 SetImageLabelSpacing(use_generic_button ? 0 : kDefaultImageTextSpacing);
226 226
227 PreferredSizeChanged(); 227 PreferredSizeChanged();
228 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698