| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 runModalLoopForApplication:app]; | 348 runModalLoopForApplication:app]; |
| 349 } | 349 } |
| 350 | 350 |
| 351 // Called when the app is shutting down. Clean-up as appropriate. | 351 // Called when the app is shutting down. Clean-up as appropriate. |
| 352 - (void)applicationWillTerminate:(NSNotification*)aNotification { | 352 - (void)applicationWillTerminate:(NSNotification*)aNotification { |
| 353 // There better be no browser windows left at this point. | 353 // There better be no browser windows left at this point. |
| 354 CHECK_EQ(0u, BrowserList::size()); | 354 CHECK_EQ(0u, BrowserList::size()); |
| 355 | 355 |
| 356 // Tell BrowserList not to keep the browser process alive. Once all the | 356 // Tell BrowserList not to keep the browser process alive. Once all the |
| 357 // browsers get dealloc'd, it will stop the RunLoop and fall back into main(). | 357 // browsers get dealloc'd, it will stop the RunLoop and fall back into main(). |
| 358 browser::EndKeepAlive(); | 358 chrome::EndKeepAlive(); |
| 359 | 359 |
| 360 [self unregisterEventHandlers]; | 360 [self unregisterEventHandlers]; |
| 361 } | 361 } |
| 362 | 362 |
| 363 - (void)didEndMainMessageLoop { | 363 - (void)didEndMainMessageLoop { |
| 364 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile])); | 364 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile])); |
| 365 if (!chrome::GetBrowserCount([self lastProfile])) { | 365 if (!chrome::GetBrowserCount([self lastProfile])) { |
| 366 // As we're shutting down, we need to nuke the TabRestoreService, which | 366 // As we're shutting down, we need to nuke the TabRestoreService, which |
| 367 // will start the shutdown of the NavigationControllers and allow for | 367 // will start the shutdown of the NavigationControllers and allow for |
| 368 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, | 368 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 CFPreferencesAppSynchronize(app); | 565 CFPreferencesAppSynchronize(app); |
| 566 } | 566 } |
| 567 #endif | 567 #endif |
| 568 } | 568 } |
| 569 | 569 |
| 570 // This is called after profiles have been loaded and preferences registered. | 570 // This is called after profiles have been loaded and preferences registered. |
| 571 // It is safe to access the default profile here. | 571 // It is safe to access the default profile here. |
| 572 - (void)applicationDidFinishLaunching:(NSNotification*)notify { | 572 - (void)applicationDidFinishLaunching:(NSNotification*)notify { |
| 573 // Notify BrowserList to keep the application running so it doesn't go away | 573 // Notify BrowserList to keep the application running so it doesn't go away |
| 574 // when all the browser windows get closed. | 574 // when all the browser windows get closed. |
| 575 browser::StartKeepAlive(); | 575 chrome::StartKeepAlive(); |
| 576 | 576 |
| 577 [self setUpdateCheckInterval]; | 577 [self setUpdateCheckInterval]; |
| 578 | 578 |
| 579 // Build up the encoding menu, the order of the items differs based on the | 579 // Build up the encoding menu, the order of the items differs based on the |
| 580 // current locale (see http://crbug.com/7647 for details). | 580 // current locale (see http://crbug.com/7647 for details). |
| 581 // We need a valid g_browser_process to get the profile which is why we can't | 581 // We need a valid g_browser_process to get the profile which is why we can't |
| 582 // call this from awakeFromNib. | 582 // call this from awakeFromNib. |
| 583 NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu]; | 583 NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu]; |
| 584 NSMenuItem* encodingMenuItem = [viewMenu itemWithTag:IDC_ENCODING_MENU]; | 584 NSMenuItem* encodingMenuItem = [viewMenu itemWithTag:IDC_ENCODING_MENU]; |
| 585 NSMenu* encodingMenu = [encodingMenuItem submenu]; | 585 NSMenu* encodingMenu = [encodingMenuItem submenu]; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 | 1350 |
| 1351 //--------------------------------------------------------------------------- | 1351 //--------------------------------------------------------------------------- |
| 1352 | 1352 |
| 1353 namespace app_controller_mac { | 1353 namespace app_controller_mac { |
| 1354 | 1354 |
| 1355 bool IsOpeningNewWindow() { | 1355 bool IsOpeningNewWindow() { |
| 1356 return g_is_opening_new_window; | 1356 return g_is_opening_new_window; |
| 1357 } | 1357 } |
| 1358 | 1358 |
| 1359 } // namespace app_controller_mac | 1359 } // namespace app_controller_mac |
| OLD | NEW |