OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
6 | 6 |
7 #include "chrome/browser/profiles/avatar_menu_model.h" | 7 #include "chrome/browser/profiles/avatar_menu_model.h" |
8 #include "chrome/browser/profiles/profile_info_util.h" | 8 #include "chrome/browser/profiles/profile_info_util.h" |
9 #include "chrome/browser/profiles/profile_metrics.h" | 9 #include "chrome/browser/profiles/profile_metrics.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, | 137 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, |
138 bool is_gaia_picture) { | 138 bool is_gaia_picture) { |
139 icon_.reset(new gfx::Image(icon)); | 139 icon_.reset(new gfx::Image(icon)); |
140 button_icon_ = SkBitmap(); | 140 button_icon_ = SkBitmap(); |
141 is_gaia_picture_ = is_gaia_picture; | 141 is_gaia_picture_ = is_gaia_picture; |
142 SchedulePaint(); | 142 SchedulePaint(); |
143 } | 143 } |
144 | 144 |
145 // views::MenuButtonDelegate implementation | 145 // views::MenuButtonListener implementation |
146 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 146 void AvatarMenuButton::OnMenuButtonClicked(views::View* source, |
| 147 const gfx::Point& point) { |
147 ShowAvatarBubble(); | 148 ShowAvatarBubble(); |
148 } | 149 } |
149 | 150 |
150 void AvatarMenuButton::ShowAvatarBubble() { | 151 void AvatarMenuButton::ShowAvatarBubble() { |
151 if (!has_menu_) | 152 if (!has_menu_) |
152 return; | 153 return; |
153 | 154 |
154 gfx::Point origin; | 155 gfx::Point origin; |
155 views::View::ConvertPointToScreen(this, &origin); | 156 views::View::ConvertPointToScreen(this, &origin); |
156 gfx::Rect bounds(origin, size()); | 157 gfx::Rect bounds(origin, size()); |
157 | 158 |
158 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, | 159 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, |
159 views::BubbleBorder::TOP_LEFT, bounds, browser_); | 160 views::BubbleBorder::TOP_LEFT, bounds, browser_); |
160 browser::CreateViewsBubble(bubble); | 161 browser::CreateViewsBubble(bubble); |
161 bubble->Show(); | 162 bubble->Show(); |
162 | 163 |
163 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 164 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
164 } | 165 } |
OLD | NEW |