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/supervised_user_avatar_label.h" | 5 #include "chrome/browser/ui/views/profiles/supervised_user_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" |
11 #include "chrome/grit/generated_resources.h" | 11 #include "chrome/grit/generated_resources.h" |
12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/theme_provider.h" | 14 #include "ui/base/theme_provider.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/color_utils.h" | 16 #include "ui/gfx/color_utils.h" |
17 #include "ui/views/border.h" | 17 #include "ui/views/border.h" |
18 #include "ui/views/painter.h" | 18 #include "ui/views/painter.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // A custom border for the supervised user avatar label. | 22 // A custom border for the supervised user avatar label. |
23 class SupervisedUserAvatarLabelBorder : public views::Border { | 23 class SupervisedUserAvatarLabelBorder : public views::Border { |
24 public: | 24 public: |
25 explicit SupervisedUserAvatarLabelBorder(bool label_on_right); | 25 explicit SupervisedUserAvatarLabelBorder(bool label_on_right); |
26 | 26 |
27 // views::Border: | 27 // views::Border: |
28 virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE; | 28 virtual void Paint(const views::View& view, gfx::Canvas* canvas) override; |
29 virtual gfx::Insets GetInsets() const OVERRIDE; | 29 virtual gfx::Insets GetInsets() const override; |
30 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 30 virtual gfx::Size GetMinimumSize() const override; |
31 | 31 |
32 private: | 32 private: |
33 scoped_ptr<views::Painter> painter_; | 33 scoped_ptr<views::Painter> painter_; |
34 gfx::Insets insets_; | 34 gfx::Insets insets_; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAvatarLabelBorder); | 36 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAvatarLabelBorder); |
37 }; | 37 }; |
38 | 38 |
39 SupervisedUserAvatarLabelBorder::SupervisedUserAvatarLabelBorder( | 39 SupervisedUserAvatarLabelBorder::SupervisedUserAvatarLabelBorder( |
40 bool label_on_right) { | 40 bool label_on_right) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 ThemeProperties::COLOR_SUPERVISED_USER_LABEL); | 123 ThemeProperties::COLOR_SUPERVISED_USER_LABEL); |
124 for (size_t state = 0; state < STATE_COUNT; ++state) | 124 for (size_t state = 0; state < STATE_COUNT; ++state) |
125 SetTextColor(static_cast<ButtonState>(state), color_label); | 125 SetTextColor(static_cast<ButtonState>(state), color_label); |
126 SchedulePaint(); | 126 SchedulePaint(); |
127 } | 127 } |
128 | 128 |
129 void SupervisedUserAvatarLabel::SetLabelOnRight(bool label_on_right) { | 129 void SupervisedUserAvatarLabel::SetLabelOnRight(bool label_on_right) { |
130 SetBorder(scoped_ptr<views::Border>( | 130 SetBorder(scoped_ptr<views::Border>( |
131 new SupervisedUserAvatarLabelBorder(label_on_right))); | 131 new SupervisedUserAvatarLabelBorder(label_on_right))); |
132 } | 132 } |
OLD | NEW |