OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profile_metrics.h" | 7 #include "chrome/browser/profiles/profile_metrics.h" |
8 #include "chrome/browser/profiles/profile_info_util.h" | 8 #include "chrome/browser/profiles/profile_info_util.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 10 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 return views::MenuButton::HitTest(point); | 144 return views::MenuButton::HitTest(point); |
145 } | 145 } |
146 | 146 |
147 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, | 147 void AvatarMenuButton::SetAvatarIcon(const gfx::Image& icon, |
148 bool is_gaia_picture) { | 148 bool is_gaia_picture) { |
149 icon_.reset(new gfx::Image(icon)); | 149 icon_.reset(new gfx::Image(icon)); |
150 button_icon_ = SkBitmap(); | 150 button_icon_ = SkBitmap(); |
151 is_gaia_picture_ = is_gaia_picture; | 151 is_gaia_picture_ = is_gaia_picture; |
152 // If the icon changes, we need to set the taskbar decoration again. | 152 // If the icon changes, we need to set the taskbar decoration again. |
153 set_taskbar_decoration_ = true; | 153 set_taskbar_decoration_ = true; |
154 | |
Peter Kasting
2011/12/05 22:02:02
Nit: Extra newline?
sail
2011/12/05 22:04:55
Done.
| |
155 SchedulePaint(); | |
154 } | 156 } |
155 | 157 |
156 // views::ViewMenuDelegate implementation | 158 // views::ViewMenuDelegate implementation |
157 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { | 159 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { |
158 ShowAvatarBubble(); | 160 ShowAvatarBubble(); |
159 } | 161 } |
160 | 162 |
161 void AvatarMenuButton::ShowAvatarBubble() { | 163 void AvatarMenuButton::ShowAvatarBubble() { |
162 if (!has_menu_) | 164 if (!has_menu_) |
163 return; | 165 return; |
164 | 166 |
165 gfx::Point origin; | 167 gfx::Point origin; |
166 views::View::ConvertPointToScreen(this, &origin); | 168 views::View::ConvertPointToScreen(this, &origin); |
167 gfx::Rect bounds(origin, size()); | 169 gfx::Rect bounds(origin, size()); |
168 | 170 |
169 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, | 171 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, |
170 views::BubbleBorder::TOP_LEFT, bounds, browser_); | 172 views::BubbleBorder::TOP_LEFT, bounds, browser_); |
171 browser::CreateViewsBubble(bubble); | 173 browser::CreateViewsBubble(bubble); |
172 bubble->Show(); | 174 bubble->Show(); |
173 | 175 |
174 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); | 176 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); |
175 } | 177 } |
OLD | NEW |