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

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

Issue 10690151: Move implementation of BrowserList onto an inner, instantiatable class, BrowserListImpl. (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 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" 5 #import "chrome/browser/ui/cocoa/profile_menu_controller.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/avatar_menu_model.h" 9 #include "chrome/browser/profiles/avatar_menu_model.h"
10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" 10 #include "chrome/browser/profiles/avatar_menu_model_observer.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_info_cache.h" 12 #include "chrome/browser/profiles/profile_info_cache.h"
13 #include "chrome/browser/profiles/profile_info_interface.h" 13 #include "chrome/browser/profiles/profile_info_interface.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/profiles/profile_metrics.h" 15 #include "chrome/browser/profiles/profile_metrics.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_list_observer.h"
18 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" 19 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
19 #import "chrome/browser/ui/cocoa/menu_controller.h" 20 #import "chrome/browser/ui/cocoa/menu_controller.h"
20 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util_mac.h" 22 #include "ui/base/l10n/l10n_util_mac.h"
22 #include "ui/gfx/image/image.h" 23 #include "ui/gfx/image/image.h"
23 24
24 @interface ProfileMenuController (Private) 25 @interface ProfileMenuController (Private)
25 - (void)initializeMenu; 26 - (void)initializeMenu;
26 @end 27 @end
27 28
28 namespace ProfileMenuControllerInternal { 29 namespace ProfileMenuControllerInternal {
29 30
30 class Observer : public BrowserList::Observer, 31 class Observer : public chrome::BrowserListObserver,
31 public AvatarMenuModelObserver { 32 public AvatarMenuModelObserver {
32 public: 33 public:
33 Observer(ProfileMenuController* controller) : controller_(controller) { 34 Observer(ProfileMenuController* controller) : controller_(controller) {
34 BrowserList::AddObserver(this); 35 BrowserList::AddObserver(this);
35 } 36 }
36 37
37 ~Observer() { 38 ~Observer() {
38 BrowserList::RemoveObserver(this); 39 BrowserList::RemoveObserver(this);
39 } 40 }
40 41
41 // BrowserList::Observer: 42 // chrome::BrowserListObserver:
42 virtual void OnBrowserAdded(Browser* browser) {} 43 virtual void OnBrowserAdded(Browser* browser) {}
43 virtual void OnBrowserRemoved(Browser* browser) { 44 virtual void OnBrowserRemoved(Browser* browser) {
44 [controller_ activeBrowserChangedTo:browser::GetLastActiveBrowser()]; 45 [controller_ activeBrowserChangedTo:browser::GetLastActiveBrowser()];
45 } 46 }
46 virtual void OnBrowserSetLastActive(Browser* browser) { 47 virtual void OnBrowserSetLastActive(Browser* browser) {
47 [controller_ activeBrowserChangedTo:browser]; 48 [controller_ activeBrowserChangedTo:browser];
48 } 49 }
49 50
50 // AvatarMenuModelObserver: 51 // AvatarMenuModelObserver:
51 virtual void OnAvatarMenuModelChanged(AvatarMenuModel* model) { 52 virtual void OnAvatarMenuModelChanged(AvatarMenuModel* model) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 168 }
168 169
169 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { 170 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel {
170 scoped_nsobject<NSMenuItem> item( 171 scoped_nsobject<NSMenuItem> item(
171 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); 172 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]);
172 [item setTarget:self]; 173 [item setTarget:self];
173 return [item.release() autorelease]; 174 return [item.release() autorelease];
174 } 175 }
175 176
176 @end 177 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698