Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: chrome/browser/ui/views/avatar_menu_button.cc

Issue 8796003: Repaint avatar button when setting icon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 SchedulePaint();
154 } 155 }
155 156
156 // views::ViewMenuDelegate implementation 157 // views::ViewMenuDelegate implementation
157 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) { 158 void AvatarMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
158 ShowAvatarBubble(); 159 ShowAvatarBubble();
159 } 160 }
160 161
161 void AvatarMenuButton::ShowAvatarBubble() { 162 void AvatarMenuButton::ShowAvatarBubble() {
162 if (!has_menu_) 163 if (!has_menu_)
163 return; 164 return;
164 165
165 gfx::Point origin; 166 gfx::Point origin;
166 views::View::ConvertPointToScreen(this, &origin); 167 views::View::ConvertPointToScreen(this, &origin);
167 gfx::Rect bounds(origin, size()); 168 gfx::Rect bounds(origin, size());
168 169
169 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, 170 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this,
170 views::BubbleBorder::TOP_LEFT, bounds, browser_); 171 views::BubbleBorder::TOP_LEFT, bounds, browser_);
171 browser::CreateViewsBubble(bubble); 172 browser::CreateViewsBubble(bubble);
172 bubble->Show(); 173 bubble->Show();
173 174
174 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); 175 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
175 } 176 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698