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

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

Issue 350183002: Rename "managed (mode|user)" to "supervised user" (part 5) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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/avatar_label.h" 5 #include "chrome/browser/ui/views/profiles/avatar_label.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/signin/signin_header_helper.h" 8 #include "chrome/browser/signin/signin_header_helper.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/ui/views/frame/browser_view.h" 10 #include "chrome/browser/ui/views/frame/browser_view.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const int kVerticalInsetBottom = 3; 43 const int kVerticalInsetBottom = 3;
44 // We want to align with the top of the tab. This works if the default font 44 // We want to align with the top of the tab. This works if the default font
45 // size is 13. If it is smaller, we need to increase the TopInset accordingly. 45 // size is 13. If it is smaller, we need to increase the TopInset accordingly.
46 const int difference = std::max<int>(0, 13 - gfx::FontList().GetFontSize()); 46 const int difference = std::max<int>(0, 13 - gfx::FontList().GetFontSize());
47 const int addToTop = difference / 2; 47 const int addToTop = difference / 2;
48 const int addToBottom = difference - addToTop; 48 const int addToBottom = difference - addToTop;
49 insets_ = gfx::Insets(kVerticalInsetTop + addToTop, 49 insets_ = gfx::Insets(kVerticalInsetTop + addToTop,
50 kHorizontalInsetLeft, 50 kHorizontalInsetLeft,
51 kVerticalInsetBottom + addToBottom, 51 kVerticalInsetBottom + addToBottom,
52 kHorizontalInsetRight); 52 kHorizontalInsetRight);
53 const int kImages[] = IMAGE_GRID(IDR_MANAGED_USER_LABEL); 53 const int kImages[] = IMAGE_GRID(IDR_SUPERVISED_USER_LABEL);
54 painter_.reset(views::Painter::CreateImageGridPainter(kImages)); 54 painter_.reset(views::Painter::CreateImageGridPainter(kImages));
55 } 55 }
56 56
57 void AvatarLabelBorder::Paint(const views::View& view, gfx::Canvas* canvas) { 57 void AvatarLabelBorder::Paint(const views::View& view, gfx::Canvas* canvas) {
58 // Paint the default background using the image assets provided by UI. This 58 // Paint the default background using the image assets provided by UI. This
59 // includes a border with almost transparent white color. 59 // includes a border with almost transparent white color.
60 painter_->Paint(canvas, view.size()); 60 painter_->Paint(canvas, view.size());
61 61
62 // Repaint the inner part of the background in order to be able to change 62 // Repaint the inner part of the background in order to be able to change
63 // the colors according to the currently installed theme. 63 // the colors according to the currently installed theme.
(...skipping 23 matching lines...) Expand all
87 gfx::Size AvatarLabelBorder::GetMinimumSize() const { 87 gfx::Size AvatarLabelBorder::GetMinimumSize() const {
88 gfx::Size size(4, 4); 88 gfx::Size size(4, 4);
89 size.SetToMax(painter_->GetMinimumSize()); 89 size.SetToMax(painter_->GetMinimumSize());
90 return size; 90 return size;
91 } 91 }
92 92
93 } // namespace 93 } // namespace
94 94
95 AvatarLabel::AvatarLabel(BrowserView* browser_view) 95 AvatarLabel::AvatarLabel(BrowserView* browser_view)
96 : LabelButton(NULL, 96 : LabelButton(NULL,
97 l10n_util::GetStringUTF16(IDS_MANAGED_USER_AVATAR_LABEL)), 97 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL)),
98 browser_view_(browser_view) { 98 browser_view_(browser_view) {
99 SetLabelOnRight(false); 99 SetLabelOnRight(false);
100 UpdateLabelStyle(); 100 UpdateLabelStyle();
101 } 101 }
102 102
103 AvatarLabel::~AvatarLabel() {} 103 AvatarLabel::~AvatarLabel() {}
104 104
105 bool AvatarLabel::OnMousePressed(const ui::MouseEvent& event) { 105 bool AvatarLabel::OnMousePressed(const ui::MouseEvent& event) {
106 if (!LabelButton::OnMousePressed(event)) 106 if (!LabelButton::OnMousePressed(event))
107 return false; 107 return false;
(...skipping 12 matching lines...) Expand all
120 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor( 120 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor(
121 ThemeProperties::COLOR_SUPERVISED_USER_LABEL); 121 ThemeProperties::COLOR_SUPERVISED_USER_LABEL);
122 for (size_t state = 0; state < STATE_COUNT; ++state) 122 for (size_t state = 0; state < STATE_COUNT; ++state)
123 SetTextColor(static_cast<ButtonState>(state), color_label); 123 SetTextColor(static_cast<ButtonState>(state), color_label);
124 SchedulePaint(); 124 SchedulePaint();
125 } 125 }
126 126
127 void AvatarLabel::SetLabelOnRight(bool label_on_right) { 127 void AvatarLabel::SetLabelOnRight(bool label_on_right) {
128 SetBorder(scoped_ptr<views::Border>(new AvatarLabelBorder(label_on_right))); 128 SetBorder(scoped_ptr<views::Border>(new AvatarLabelBorder(label_on_right)));
129 } 129 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_label_button.mm ('k') | chrome/browser/ui/views/profiles/new_avatar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698