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

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

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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
OLDNEW
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/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/command_updater.h" 9 #include "chrome/browser/command_updater.h"
10 #include "chrome/browser/managed_mode.h" 10 #include "chrome/browser/managed_mode.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/avatar_menu_model.h" 12 #include "chrome/browser/profiles/avatar_menu_model.h"
13 #include "chrome/browser/profiles/profile_info_util.h" 13 #include "chrome/browser/profiles/profile_info_util.h"
14 #include "chrome/browser/profiles/profile_metrics.h" 14 #include "chrome/browser/profiles/profile_metrics.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_commands.h"
16 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" 17 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
17 #include "chrome/browser/ui/views/frame/browser_view.h" 18 #include "chrome/browser/ui/views/frame/browser_view.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "ui/gfx/canvas.h" 22 #include "ui/gfx/canvas.h"
22 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
23 24
24 25
25 #if defined(OS_WIN) 26 #if defined(OS_WIN)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (incognito_) 153 if (incognito_)
153 return; 154 return;
154 155
155 if (ManagedMode::IsInManagedMode()) 156 if (ManagedMode::IsInManagedMode())
156 ManagedMode::LeaveManagedMode(); 157 ManagedMode::LeaveManagedMode();
157 else 158 else
158 ShowAvatarBubble(); 159 ShowAvatarBubble();
159 } 160 }
160 161
161 void AvatarMenuButton::ShowAvatarBubble() { 162 void AvatarMenuButton::ShowAvatarBubble() {
162 DCHECK(browser_->command_updater()->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 163 DCHECK(chrome::IsCommandEnabled(browser_, IDC_SHOW_AVATAR_MENU));
163 164
164 gfx::Point origin; 165 gfx::Point origin;
165 views::View::ConvertPointToScreen(this, &origin); 166 views::View::ConvertPointToScreen(this, &origin);
166 gfx::Rect bounds(origin, size()); 167 gfx::Rect bounds(origin, size());
167 168
168 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this, 169 AvatarMenuBubbleView* bubble = new AvatarMenuBubbleView(this,
169 views::BubbleBorder::TOP_LEFT, bounds, browser_); 170 views::BubbleBorder::TOP_LEFT, bounds, browser_);
170 views::BubbleDelegateView::CreateBubble(bubble); 171 views::BubbleDelegateView::CreateBubble(bubble);
171 bubble->Show(); 172 bubble->Show();
172 173
173 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); 174 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
174 } 175 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698