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

Side by Side Diff: chrome/browser/app_controller_mac.h

Issue 14923004: [Mac] AppController needs to update its "last profile" pointer when the active profile is deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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
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 #ifndef CHROME_BROWSER_APP_CONTROLLER_MAC_H_ 5 #ifndef CHROME_BROWSER_APP_CONTROLLER_MAC_H_
6 #define CHROME_BROWSER_APP_CONTROLLER_MAC_H_ 6 #define CHROME_BROWSER_APP_CONTROLLER_MAC_H_
7 7
8 #if defined(__OBJC__) 8 #if defined(__OBJC__)
9 9
10 #import <Cocoa/Cocoa.h> 10 #import <Cocoa/Cocoa.h>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/scoped_nsobject.h" 13 #include "base/memory/scoped_nsobject.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/observer_list.h" 15 #include "base/observer_list.h"
16 #include "base/prefs/pref_change_registrar.h" 16 #include "base/prefs/pref_change_registrar.h"
17 #include "chrome/browser/app_controller_profile_observer.h"
17 #include "ui/base/work_area_watcher_observer.h" 18 #include "ui/base/work_area_watcher_observer.h"
18 19
20 class AppControllerProfileObserver;
19 class BookmarkMenuBridge; 21 class BookmarkMenuBridge;
20 class CommandUpdater; 22 class CommandUpdater;
21 class GURL; 23 class GURL;
22 class HistoryMenuBridge; 24 class HistoryMenuBridge;
23 class Profile; 25 class Profile;
24 @class ProfileMenuController; 26 @class ProfileMenuController;
25 namespace ui { 27 namespace ui {
26 class WorkAreaWatcherObserver; 28 class WorkAreaWatcherObserver;
27 } 29 }
28 30
29 // The application controller object, created by loading the MainMenu nib. 31 // The application controller object, created by loading the MainMenu nib.
30 // This handles things like responding to menus when there are no windows 32 // This handles things like responding to menus when there are no windows
31 // open, etc and acts as the NSApplication delegate. 33 // open, etc and acts as the NSApplication delegate.
32 @interface AppController : NSObject<NSUserInterfaceValidations, 34 @interface AppController : NSObject<NSUserInterfaceValidations,
33 NSApplicationDelegate> { 35 NSApplicationDelegate> {
34 @private 36 @private
35 // Manages the state of the command menu items. 37 // Manages the state of the command menu items.
36 scoped_ptr<CommandUpdater> menuState_; 38 scoped_ptr<CommandUpdater> menuState_;
37 39
38 // The profile last used by a Browser. It is this profile that was used to 40 // The profile last used by a Browser. It is this profile that was used to
39 // build the user-data specific main menu items. 41 // build the user-data specific main menu items.
40 Profile* lastProfile_; 42 Profile* lastProfile_;
41 43
44 // The ProfileObserver observes the ProfileInfoCache and gets notified
45 // when a profile has been deleted.
46 AppControllerProfileObserver* profileInfoCacheObserver_;
47
42 // Management of the bookmark menu which spans across all windows 48 // Management of the bookmark menu which spans across all windows
43 // (and Browser*s). 49 // (and Browser*s).
44 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; 50 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_;
45 scoped_ptr<HistoryMenuBridge> historyMenuBridge_; 51 scoped_ptr<HistoryMenuBridge> historyMenuBridge_;
46 52
47 // The profile menu, which appears right before the Help menu. It is only 53 // The profile menu, which appears right before the Help menu. It is only
48 // available when multiple profiles is enabled. 54 // available when multiple profiles is enabled.
49 scoped_nsobject<ProfileMenuController> profileMenuController_; 55 scoped_nsobject<ProfileMenuController> profileMenuController_;
50 56
51 // If we're told to open URLs (in particular, via |-application:openFiles:| by 57 // If we're told to open URLs (in particular, via |-application:openFiles:| by
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth 100 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth
95 // sheets) will not count as blocking the browser. But things like open/save 101 // sheets) will not count as blocking the browser. But things like open/save
96 // dialogs that are window modal will block the browser. 102 // dialogs that are window modal will block the browser.
97 - (BOOL)keyWindowIsModal; 103 - (BOOL)keyWindowIsModal;
98 104
99 // Show the preferences window, or bring it to the front if it's already 105 // Show the preferences window, or bring it to the front if it's already
100 // visible. 106 // visible.
101 - (IBAction)showPreferences:(id)sender; 107 - (IBAction)showPreferences:(id)sender;
102 108
103 // Redirect in the menu item from the expected target of "File's 109 // Redirect in the menu item from the expected target of "File's
104 // Owner" (NSAppliation) for a Branded About Box 110 // Owner" (NSApplication) for a Branded About Box
105 - (IBAction)orderFrontStandardAboutPanel:(id)sender; 111 - (IBAction)orderFrontStandardAboutPanel:(id)sender;
106 112
107 // Toggles the "Confirm to Quit" preference. 113 // Toggles the "Confirm to Quit" preference.
108 - (IBAction)toggleConfirmToQuit:(id)sender; 114 - (IBAction)toggleConfirmToQuit:(id)sender;
109 115
110 // Delegate method to return the dock menu. 116 // Delegate method to return the dock menu.
111 - (NSMenu*)applicationDockMenu:(NSApplication*)sender; 117 - (NSMenu*)applicationDockMenu:(NSApplication*)sender;
112 118
113 // Get the URLs that Launch Services expects the browser to open at startup. 119 // Get the URLs that Launch Services expects the browser to open at startup.
114 - (const std::vector<GURL>&)startupUrls; 120 - (const std::vector<GURL>&)startupUrls;
115 121
116 // Clear the list of startup URLs. 122 // Clear the list of startup URLs.
117 - (void)clearStartupUrls; 123 - (void)clearStartupUrls;
118 124
119 - (BookmarkMenuBridge*)bookmarkMenuBridge; 125 - (BookmarkMenuBridge*)bookmarkMenuBridge;
120 126
121 // Subscribes/unsubscribes from the work area change notification. 127 // Subscribes/unsubscribes from the work area change notification.
122 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer; 128 - (void)addObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer;
123 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer; 129 - (void)removeObserverForWorkAreaChange:(ui::WorkAreaWatcherObserver*)observer;
124 130
131 // If the last used profile was removed we need to NULL it out
132 // so that it can be recreated correctly when the next browser window is open
133 - (void)profileWasRemoved:(const string16&)profileName;
134
125 @end 135 @end
126 136
127 #endif // __OBJC__ 137 #endif // __OBJC__
128 138
129 // Functions that may be accessed from non-Objective-C C/C++ code. 139 // Functions that may be accessed from non-Objective-C C/C++ code.
130 140
131 namespace app_controller_mac { 141 namespace app_controller_mac {
132 142
133 // True if we are currently handling an IDC_NEW_{TAB,WINDOW} command. Used in 143 // True if we are currently handling an IDC_NEW_{TAB,WINDOW} command. Used in
134 // SessionService::Observe() to get around windows/linux and mac having 144 // SessionService::Observe() to get around windows/linux and mac having
135 // different models of application lifetime. 145 // different models of application lifetime.
136 bool IsOpeningNewWindow(); 146 bool IsOpeningNewWindow();
137 147
138 } // namespace app_controller_mac 148 } // namespace app_controller_mac
139 149
140 #endif 150 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_controller_mac.mm » ('j') | chrome/browser/app_controller_profile_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698