| 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/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| 11 #include "components/signin/core/browser/signin_header_helper.h" | 11 #include "components/signin/core/browser/signin_header_helper.h" |
| 12 #include "components/signin/core/browser/signin_metrics.h" |
| 12 #include "grit/theme_resources.h" | 13 #include "grit/theme_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/theme_provider.h" | 15 #include "ui/base/theme_provider.h" |
| 15 #include "ui/gfx/canvas.h" | 16 #include "ui/gfx/canvas.h" |
| 16 #include "ui/gfx/color_utils.h" | 17 #include "ui/gfx/color_utils.h" |
| 17 #include "ui/views/border.h" | 18 #include "ui/views/border.h" |
| 18 #include "ui/views/painter.h" | 19 #include "ui/views/painter.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 UpdateLabelStyle(); | 103 UpdateLabelStyle(); |
| 103 } | 104 } |
| 104 | 105 |
| 105 SupervisedUserAvatarLabel::~SupervisedUserAvatarLabel() {} | 106 SupervisedUserAvatarLabel::~SupervisedUserAvatarLabel() {} |
| 106 | 107 |
| 107 bool SupervisedUserAvatarLabel::OnMousePressed(const ui::MouseEvent& event) { | 108 bool SupervisedUserAvatarLabel::OnMousePressed(const ui::MouseEvent& event) { |
| 108 if (!LabelButton::OnMousePressed(event)) | 109 if (!LabelButton::OnMousePressed(event)) |
| 109 return false; | 110 return false; |
| 110 | 111 |
| 111 browser_view_->ShowAvatarBubbleFromAvatarButton( | 112 browser_view_->ShowAvatarBubbleFromAvatarButton( |
| 112 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, | 113 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, signin::ManageAccountsParams(), |
| 113 signin::ManageAccountsParams()); | 114 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
| 114 return true; | 115 return true; |
| 115 } | 116 } |
| 116 | 117 |
| 117 void SupervisedUserAvatarLabel::UpdateLabelStyle() { | 118 void SupervisedUserAvatarLabel::UpdateLabelStyle() { |
| 118 // |browser_view_| can be NULL in unit tests. | 119 // |browser_view_| can be NULL in unit tests. |
| 119 if (!browser_view_) | 120 if (!browser_view_) |
| 120 return; | 121 return; |
| 121 | 122 |
| 122 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor( | 123 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor( |
| 123 ThemeProperties::COLOR_SUPERVISED_USER_LABEL); | 124 ThemeProperties::COLOR_SUPERVISED_USER_LABEL); |
| 124 for (size_t state = 0; state < STATE_COUNT; ++state) | 125 for (size_t state = 0; state < STATE_COUNT; ++state) |
| 125 SetTextColor(static_cast<ButtonState>(state), color_label); | 126 SetTextColor(static_cast<ButtonState>(state), color_label); |
| 126 SchedulePaint(); | 127 SchedulePaint(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void SupervisedUserAvatarLabel::SetLabelOnRight(bool label_on_right) { | 130 void SupervisedUserAvatarLabel::SetLabelOnRight(bool label_on_right) { |
| 130 SetBorder(scoped_ptr<views::Border>( | 131 SetBorder(scoped_ptr<views::Border>( |
| 131 new SupervisedUserAvatarLabelBorder(label_on_right))); | 132 new SupervisedUserAvatarLabelBorder(label_on_right))); |
| 132 } | 133 } |
| OLD | NEW |