| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 528 |
| 529 [self unregisterEventHandlers]; | 529 [self unregisterEventHandlers]; |
| 530 | 530 |
| 531 appShimMenuController_.reset(); | 531 appShimMenuController_.reset(); |
| 532 | 532 |
| 533 STLDeleteContainerPairSecondPointers(profileBookmarkMenuBridgeMap_.begin(), | 533 STLDeleteContainerPairSecondPointers(profileBookmarkMenuBridgeMap_.begin(), |
| 534 profileBookmarkMenuBridgeMap_.end()); | 534 profileBookmarkMenuBridgeMap_.end()); |
| 535 } | 535 } |
| 536 | 536 |
| 537 - (void)didEndMainMessageLoop { | 537 - (void)didEndMainMessageLoop { |
| 538 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile], | 538 DCHECK_EQ(0u, chrome::GetBrowserCount([self lastProfile])); |
| 539 chrome::HOST_DESKTOP_TYPE_NATIVE)); | 539 if (!chrome::GetBrowserCount([self lastProfile])) { |
| 540 if (!chrome::GetBrowserCount([self lastProfile], | |
| 541 chrome::HOST_DESKTOP_TYPE_NATIVE)) { | |
| 542 // As we're shutting down, we need to nuke the TabRestoreService, which | 540 // As we're shutting down, we need to nuke the TabRestoreService, which |
| 543 // will start the shutdown of the NavigationControllers and allow for | 541 // will start the shutdown of the NavigationControllers and allow for |
| 544 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, | 542 // proper shutdown. If we don't do this, Chrome won't shut down cleanly, |
| 545 // and may end up crashing when some thread tries to use the IO thread (or | 543 // and may end up crashing when some thread tries to use the IO thread (or |
| 546 // another thread) that is no longer valid. | 544 // another thread) that is no longer valid. |
| 547 TabRestoreServiceFactory::ResetForProfile([self lastProfile]); | 545 TabRestoreServiceFactory::ResetForProfile([self lastProfile]); |
| 548 } | 546 } |
| 549 } | 547 } |
| 550 | 548 |
| 551 // If the window has a tab controller, make "close window" be cmd-shift-w, | 549 // If the window has a tab controller, make "close window" be cmd-shift-w, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 DownloadServiceFactory::GetForBrowserContext(profiles[i]); | 842 DownloadServiceFactory::GetForBrowserContext(profiles[i]); |
| 845 DownloadManager* download_manager = | 843 DownloadManager* download_manager = |
| 846 (download_service->HasCreatedDownloadManager() ? | 844 (download_service->HasCreatedDownloadManager() ? |
| 847 BrowserContext::GetDownloadManager(profiles[i]) : NULL); | 845 BrowserContext::GetDownloadManager(profiles[i]) : NULL); |
| 848 if (download_manager && | 846 if (download_manager && |
| 849 download_manager->NonMaliciousInProgressCount() > 0) { | 847 download_manager->NonMaliciousInProgressCount() > 0) { |
| 850 int downloadCount = download_manager->NonMaliciousInProgressCount(); | 848 int downloadCount = download_manager->NonMaliciousInProgressCount(); |
| 851 if ([self userWillWaitForInProgressDownloads:downloadCount]) { | 849 if ([self userWillWaitForInProgressDownloads:downloadCount]) { |
| 852 // Create a new browser window (if necessary) and navigate to the | 850 // Create a new browser window (if necessary) and navigate to the |
| 853 // downloads page if the user chooses to wait. | 851 // downloads page if the user chooses to wait. |
| 854 Browser* browser = chrome::FindBrowserWithProfile( | 852 Browser* browser = chrome::FindBrowserWithProfile(profiles[i]); |
| 855 profiles[i], chrome::HOST_DESKTOP_TYPE_NATIVE); | |
| 856 if (!browser) { | 853 if (!browser) { |
| 857 browser = new Browser(Browser::CreateParams( | 854 browser = new Browser(Browser::CreateParams( |
| 858 profiles[i], chrome::HOST_DESKTOP_TYPE_NATIVE)); | 855 profiles[i], chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 859 browser->window()->Show(); | 856 browser->window()->Show(); |
| 860 } | 857 } |
| 861 DCHECK(browser); | 858 DCHECK(browser); |
| 862 chrome::ShowDownloads(browser); | 859 chrome::ShowDownloads(browser); |
| 863 return NO; | 860 return NO; |
| 864 } | 861 } |
| 865 | 862 |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 | 1697 |
| 1701 //--------------------------------------------------------------------------- | 1698 //--------------------------------------------------------------------------- |
| 1702 | 1699 |
| 1703 namespace app_controller_mac { | 1700 namespace app_controller_mac { |
| 1704 | 1701 |
| 1705 bool IsOpeningNewWindow() { | 1702 bool IsOpeningNewWindow() { |
| 1706 return g_is_opening_new_window; | 1703 return g_is_opening_new_window; |
| 1707 } | 1704 } |
| 1708 | 1705 |
| 1709 } // namespace app_controller_mac | 1706 } // namespace app_controller_mac |
| OLD | NEW |