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

Side by Side Diff: chrome/browser/ui/cocoa/browser/avatar_button_controller.mm

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
« no previous file with comments | « chrome/browser/ui/browser_unittest.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | 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) 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 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/command_updater.h" 10 #include "chrome/browser/command_updater.h"
11 #include "chrome/browser/managed_mode.h" 11 #include "chrome/browser/managed_mode.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/profiles/profile_info_cache.h" 13 #include "chrome/browser/profiles/profile_info_cache.h"
14 #include "chrome/browser/profiles/profile_info_util.h" 14 #include "chrome/browser/profiles/profile_info_util.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/profiles/profile_metrics.h" 16 #include "chrome/browser/profiles/profile_metrics.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_commands.h"
18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
19 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" 20 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
20 #import "chrome/browser/ui/cocoa/browser_window_controller.h" 21 #import "chrome/browser/ui/cocoa/browser_window_controller.h"
21 #import "chrome/browser/ui/cocoa/image_utils.h" 22 #import "chrome/browser/ui/cocoa/image_utils.h"
22 #import "chrome/browser/ui/cocoa/menu_controller.h" 23 #import "chrome/browser/ui/cocoa/menu_controller.h"
23 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
24 #include "content/public/browser/notification_service.h" 25 #include "content/public/browser/notification_service.h"
25 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
27 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 152 }
152 153
153 - (void)setImage:(NSImage*)image { 154 - (void)setImage:(NSImage*)image {
154 [self.buttonView setImage:image]; 155 [self.buttonView setImage:image];
155 } 156 }
156 157
157 - (void)showAvatarBubble { 158 - (void)showAvatarBubble {
158 if (menuController_) 159 if (menuController_)
159 return; 160 return;
160 161
161 DCHECK(browser_->command_updater()->IsCommandEnabled(IDC_SHOW_AVATAR_MENU)); 162 DCHECK(chrome::IsCommandEnabled(browser_, IDC_SHOW_AVATAR_MENU));
162 163
163 NSWindowController* wc = 164 NSWindowController* wc =
164 [browser_->window()->GetNativeWindow() windowController]; 165 [browser_->window()->GetNativeWindow() windowController];
165 if ([wc isKindOfClass:[BrowserWindowController class]]) { 166 if ([wc isKindOfClass:[BrowserWindowController class]]) {
166 [static_cast<BrowserWindowController*>(wc) 167 [static_cast<BrowserWindowController*>(wc)
167 lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; 168 lockBarVisibilityForOwner:self withAnimation:NO delay:NO];
168 } 169 }
169 170
170 NSView* view = self.view; 171 NSView* view = self.view;
171 NSPoint point = NSMakePoint(NSMidX([view bounds]), 172 NSPoint point = NSMakePoint(NSMidX([view bounds]),
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 [static_cast<BrowserWindowController*>(wc) layoutSubviews]; 290 [static_cast<BrowserWindowController*>(wc) layoutSubviews];
290 } 291 }
291 292
292 // Testing ///////////////////////////////////////////////////////////////////// 293 // Testing /////////////////////////////////////////////////////////////////////
293 294
294 - (AvatarMenuBubbleController*)menuController { 295 - (AvatarMenuBubbleController*)menuController {
295 return menuController_; 296 return menuController_;
296 } 297 }
297 298
298 @end 299 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_unittest.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698