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" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 UpdateLabelStyle(); | 102 UpdateLabelStyle(); |
103 } | 103 } |
104 | 104 |
105 SupervisedUserAvatarLabel::~SupervisedUserAvatarLabel() {} | 105 SupervisedUserAvatarLabel::~SupervisedUserAvatarLabel() {} |
106 | 106 |
107 bool SupervisedUserAvatarLabel::OnMousePressed(const ui::MouseEvent& event) { | 107 bool SupervisedUserAvatarLabel::OnMousePressed(const ui::MouseEvent& event) { |
108 if (!LabelButton::OnMousePressed(event)) | 108 if (!LabelButton::OnMousePressed(event)) |
109 return false; | 109 return false; |
110 | 110 |
111 browser_view_->ShowAvatarBubbleFromAvatarButton( | 111 browser_view_->ShowAvatarBubbleFromAvatarButton( |
112 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, | 112 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT, signin::ManageAccountsParams(), |
113 signin::ManageAccountsParams()); | 113 signin_metrics::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN); |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 void SupervisedUserAvatarLabel::UpdateLabelStyle() { | 117 void SupervisedUserAvatarLabel::UpdateLabelStyle() { |
118 // |browser_view_| can be NULL in unit tests. | 118 // |browser_view_| can be NULL in unit tests. |
119 if (!browser_view_) | 119 if (!browser_view_) |
120 return; | 120 return; |
121 | 121 |
122 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor( | 122 SkColor color_label = browser_view_->frame()->GetThemeProvider()->GetColor( |
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 |