| OLD | NEW |
| 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/mac/scoped_nsobject.h" | 13 #include "base/mac/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 "ui/base/work_area_watcher_observer.h" | 17 #include "ui/base/work_area_watcher_observer.h" |
| 18 | 18 |
| 19 class AppControllerProfileObserver; |
| 19 class BookmarkMenuBridge; | 20 class BookmarkMenuBridge; |
| 20 class CommandUpdater; | 21 class CommandUpdater; |
| 21 class GURL; | 22 class GURL; |
| 22 class HistoryMenuBridge; | 23 class HistoryMenuBridge; |
| 23 class Profile; | 24 class Profile; |
| 24 @class ProfileMenuController; | 25 @class ProfileMenuController; |
| 25 namespace ui { | 26 namespace ui { |
| 26 class WorkAreaWatcherObserver; | 27 class WorkAreaWatcherObserver; |
| 27 } | 28 } |
| 28 | 29 |
| 29 // The application controller object, created by loading the MainMenu nib. | 30 // The application controller object, created by loading the MainMenu nib. |
| 30 // This handles things like responding to menus when there are no windows | 31 // This handles things like responding to menus when there are no windows |
| 31 // open, etc and acts as the NSApplication delegate. | 32 // open, etc and acts as the NSApplication delegate. |
| 32 @interface AppController : NSObject<NSUserInterfaceValidations, | 33 @interface AppController : NSObject<NSUserInterfaceValidations, |
| 33 NSApplicationDelegate> { | 34 NSApplicationDelegate> { |
| 34 @private | 35 @private |
| 35 // Manages the state of the command menu items. | 36 // Manages the state of the command menu items. |
| 36 scoped_ptr<CommandUpdater> menuState_; | 37 scoped_ptr<CommandUpdater> menuState_; |
| 37 | 38 |
| 38 // The profile last used by a Browser. It is this profile that was used to | 39 // The profile last used by a Browser. It is this profile that was used to |
| 39 // build the user-data specific main menu items. | 40 // build the user-data specific main menu items. |
| 40 Profile* lastProfile_; | 41 Profile* lastProfile_; |
| 41 | 42 |
| 43 // The ProfileObserver observes the ProfileInfoCache and gets notified |
| 44 // when a profile has been deleted. |
| 45 scoped_ptr<AppControllerProfileObserver> profileInfoCacheObserver_; |
| 46 |
| 42 // Management of the bookmark menu which spans across all windows | 47 // Management of the bookmark menu which spans across all windows |
| 43 // (and Browser*s). | 48 // (and Browser*s). |
| 44 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; | 49 scoped_ptr<BookmarkMenuBridge> bookmarkMenuBridge_; |
| 45 scoped_ptr<HistoryMenuBridge> historyMenuBridge_; | 50 scoped_ptr<HistoryMenuBridge> historyMenuBridge_; |
| 46 | 51 |
| 47 // The profile menu, which appears right before the Help menu. It is only | 52 // The profile menu, which appears right before the Help menu. It is only |
| 48 // available when multiple profiles is enabled. | 53 // available when multiple profiles is enabled. |
| 49 base::scoped_nsobject<ProfileMenuController> profileMenuController_; | 54 base::scoped_nsobject<ProfileMenuController> profileMenuController_; |
| 50 | 55 |
| 51 // If we're told to open URLs (in particular, via |-application:openFiles:| by | 56 // 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 Loading... |
| 94 // modal) blocking the active browser. Note that tab modal dialogs (HTTP auth | 99 // 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 | 100 // sheets) will not count as blocking the browser. But things like open/save |
| 96 // dialogs that are window modal will block the browser. | 101 // dialogs that are window modal will block the browser. |
| 97 - (BOOL)keyWindowIsModal; | 102 - (BOOL)keyWindowIsModal; |
| 98 | 103 |
| 99 // Show the preferences window, or bring it to the front if it's already | 104 // Show the preferences window, or bring it to the front if it's already |
| 100 // visible. | 105 // visible. |
| 101 - (IBAction)showPreferences:(id)sender; | 106 - (IBAction)showPreferences:(id)sender; |
| 102 | 107 |
| 103 // Redirect in the menu item from the expected target of "File's | 108 // Redirect in the menu item from the expected target of "File's |
| 104 // Owner" (NSAppliation) for a Branded About Box | 109 // Owner" (NSApplication) for a Branded About Box |
| 105 - (IBAction)orderFrontStandardAboutPanel:(id)sender; | 110 - (IBAction)orderFrontStandardAboutPanel:(id)sender; |
| 106 | 111 |
| 107 // Toggles the "Confirm to Quit" preference. | 112 // Toggles the "Confirm to Quit" preference. |
| 108 - (IBAction)toggleConfirmToQuit:(id)sender; | 113 - (IBAction)toggleConfirmToQuit:(id)sender; |
| 109 | 114 |
| 110 // Delegate method to return the dock menu. | 115 // Delegate method to return the dock menu. |
| 111 - (NSMenu*)applicationDockMenu:(NSApplication*)sender; | 116 - (NSMenu*)applicationDockMenu:(NSApplication*)sender; |
| 112 | 117 |
| 113 // Get the URLs that Launch Services expects the browser to open at startup. | 118 // Get the URLs that Launch Services expects the browser to open at startup. |
| 114 - (const std::vector<GURL>&)startupUrls; | 119 - (const std::vector<GURL>&)startupUrls; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 131 namespace app_controller_mac { | 136 namespace app_controller_mac { |
| 132 | 137 |
| 133 // True if we are currently handling an IDC_NEW_{TAB,WINDOW} command. Used in | 138 // 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 | 139 // SessionService::Observe() to get around windows/linux and mac having |
| 135 // different models of application lifetime. | 140 // different models of application lifetime. |
| 136 bool IsOpeningNewWindow(); | 141 bool IsOpeningNewWindow(); |
| 137 | 142 |
| 138 } // namespace app_controller_mac | 143 } // namespace app_controller_mac |
| 139 | 144 |
| 140 #endif | 145 #endif |
| OLD | NEW |