Chromium Code Reviews| 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 #import "chrome/browser/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" | 7 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/shell_window_registry.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 #include "chrome/browser/sync/profile_sync_service.h" | 46 #include "chrome/browser/sync/profile_sync_service.h" |
| 47 #include "chrome/browser/sync/sync_ui_util.h" | 47 #include "chrome/browser/sync/sync_ui_util.h" |
| 48 #include "chrome/browser/ui/browser.h" | 48 #include "chrome/browser/ui/browser.h" |
| 49 #include "chrome/browser/ui/browser_command_controller.h" | 49 #include "chrome/browser/ui/browser_command_controller.h" |
| 50 #include "chrome/browser/ui/browser_commands.h" | 50 #include "chrome/browser/ui/browser_commands.h" |
| 51 #include "chrome/browser/ui/browser_finder.h" | 51 #include "chrome/browser/ui/browser_finder.h" |
| 52 #include "chrome/browser/ui/browser_iterator.h" | 52 #include "chrome/browser/ui/browser_iterator.h" |
| 53 #include "chrome/browser/ui/browser_mac.h" | 53 #include "chrome/browser/ui/browser_mac.h" |
| 54 #include "chrome/browser/ui/browser_window.h" | 54 #include "chrome/browser/ui/browser_window.h" |
| 55 #include "chrome/browser/ui/chrome_pages.h" | 55 #include "chrome/browser/ui/chrome_pages.h" |
| 56 #import "chrome/browser/ui/cocoa/apps/app_menu_controller_mac.h" | |
| 56 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 57 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
| 57 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 58 #import "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
| 58 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 59 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 59 #import "chrome/browser/ui/cocoa/confirm_quit.h" | 60 #import "chrome/browser/ui/cocoa/confirm_quit.h" |
| 60 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 61 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
| 61 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | 62 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
| 62 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 63 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
| 63 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 64 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
| 64 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" | 65 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" |
| 65 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 66 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 selector:@selector(popoverDidClose:) | 308 selector:@selector(popoverDidClose:) |
| 308 name:NSPopoverDidCloseNotification | 309 name:NSPopoverDidCloseNotification |
| 309 object:nil]; | 310 object:nil]; |
| 310 } | 311 } |
| 311 | 312 |
| 312 // Set up the command updater for when there are no windows open | 313 // Set up the command updater for when there are no windows open |
| 313 [self initMenuState]; | 314 [self initMenuState]; |
| 314 | 315 |
| 315 // Initialize the Profile menu. | 316 // Initialize the Profile menu. |
| 316 [self initProfileMenu]; | 317 [self initProfileMenu]; |
| 318 | |
| 319 // Initialize the app menu controller. | |
| 320 appMenuController_.reset([[AppMenuController alloc] init]); | |
|
tapted
2013/08/15 04:39:23
I think we should guard this with the enable app s
jackhou1
2013/08/16 02:50:41
Done.
| |
| 317 } | 321 } |
| 318 | 322 |
| 319 - (void)unregisterEventHandlers { | 323 - (void)unregisterEventHandlers { |
| 320 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; | 324 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; |
| 321 [em removeEventHandlerForEventClass:kInternetEventClass | 325 [em removeEventHandlerForEventClass:kInternetEventClass |
| 322 andEventID:kAEGetURL]; | 326 andEventID:kAEGetURL]; |
| 323 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass | 327 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass |
| 324 andEventID:cloud_print::kAECloudPrintClass]; | 328 andEventID:cloud_print::kAECloudPrintClass]; |
| 325 [em removeEventHandlerForEventClass:'WWW!' | 329 [em removeEventHandlerForEventClass:'WWW!' |
| 326 andEventID:'OURL']; | 330 andEventID:'OURL']; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 425 CHECK_EQ(0u, chrome::GetTotalBrowserCount()); | 429 CHECK_EQ(0u, chrome::GetTotalBrowserCount()); |
| 426 | 430 |
| 427 // Tell BrowserList not to keep the browser process alive. Once all the | 431 // Tell BrowserList not to keep the browser process alive. Once all the |
| 428 // browsers get dealloc'd, it will stop the RunLoop and fall back into main(). | 432 // browsers get dealloc'd, it will stop the RunLoop and fall back into main(). |
| 429 chrome::EndKeepAlive(); | 433 chrome::EndKeepAlive(); |
| 430 | 434 |
| 431 // Reset all pref watching, as this object outlives the prefs system. | 435 // Reset all pref watching, as this object outlives the prefs system. |
| 432 profilePrefRegistrar_.reset(); | 436 profilePrefRegistrar_.reset(); |
| 433 localPrefRegistrar_.RemoveAll(); | 437 localPrefRegistrar_.RemoveAll(); |
| 434 | 438 |
| 435 [self unregisterEventHandlers]; | 439 [self unregisterEventHandlers]; |
|
tapted
2013/08/15 04:39:23
You should call into appMenuController_ to unregis
jackhou1
2013/08/16 02:50:41
Done.
| |
| 436 } | 440 } |
| 437 | 441 |
| 438 - (void)didEndMainMessageLoop { | 442 - (void)didEndMainMessageLoop { |
| 439 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile], | 443 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile], |
| 440 chrome::HOST_DESKTOP_TYPE_NATIVE)); | 444 chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 441 if (!chrome::GetBrowserCount([self lastProfile], | 445 if (!chrome::GetBrowserCount([self lastProfile], |
| 442 chrome::HOST_DESKTOP_TYPE_NATIVE)) { | 446 chrome::HOST_DESKTOP_TYPE_NATIVE)) { |
| 443 // As we're shutting down, we need to nuke the TabRestoreService, which | 447 // As we're shutting down, we need to nuke the TabRestoreService, which |
| 444 // will start the shutdown of the NavigationControllers and allow for | 448 // will start the shutdown of the NavigationControllers and allow for |
| 445 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, | 449 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1420 | 1424 |
| 1421 //--------------------------------------------------------------------------- | 1425 //--------------------------------------------------------------------------- |
| 1422 | 1426 |
| 1423 namespace app_controller_mac { | 1427 namespace app_controller_mac { |
| 1424 | 1428 |
| 1425 bool IsOpeningNewWindow() { | 1429 bool IsOpeningNewWindow() { |
| 1426 return g_is_opening_new_window; | 1430 return g_is_opening_new_window; |
| 1427 } | 1431 } |
| 1428 | 1432 |
| 1429 } // namespace app_controller_mac | 1433 } // namespace app_controller_mac |
| OLD | NEW |