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