| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "content/public/browser/notification_service.h" | 67 #include "content/public/browser/notification_service.h" |
| 68 #include "content/public/browser/notification_types.h" | 68 #include "content/public/browser/notification_types.h" |
| 69 #include "content/public/browser/user_metrics.h" | 69 #include "content/public/browser/user_metrics.h" |
| 70 #include "grit/chromium_strings.h" | 70 #include "grit/chromium_strings.h" |
| 71 #include "grit/generated_resources.h" | 71 #include "grit/generated_resources.h" |
| 72 #include "net/base/net_util.h" | 72 #include "net/base/net_util.h" |
| 73 #include "ui/base/accelerators/accelerator_cocoa.h" | 73 #include "ui/base/accelerators/accelerator_cocoa.h" |
| 74 #include "ui/base/l10n/l10n_util.h" | 74 #include "ui/base/l10n/l10n_util.h" |
| 75 #include "ui/base/l10n/l10n_util_mac.h" | 75 #include "ui/base/l10n/l10n_util_mac.h" |
| 76 | 76 |
| 77 using content::BrowserContext; |
| 77 using content::BrowserThread; | 78 using content::BrowserThread; |
| 78 using content::DownloadManager; | 79 using content::DownloadManager; |
| 79 using content::UserMetricsAction; | 80 using content::UserMetricsAction; |
| 80 | 81 |
| 81 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help | 82 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help |
| 82 // menu. Provide the declaration so it can be called below when building with | 83 // menu. Provide the declaration so it can be called below when building with |
| 83 // the 10.5 SDK. | 84 // the 10.5 SDK. |
| 84 #if !defined(MAC_OS_X_VERSION_10_6) || \ | 85 #if !defined(MAC_OS_X_VERSION_10_6) || \ |
| 85 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 | 86 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 |
| 86 @interface NSApplication (SnowLeopardSDKDeclarations) | 87 @interface NSApplication (SnowLeopardSDKDeclarations) |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 670 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 670 if (!profile_manager) | 671 if (!profile_manager) |
| 671 return YES; | 672 return YES; |
| 672 | 673 |
| 673 std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles()); | 674 std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles()); |
| 674 for (size_t i = 0; i < profiles.size(); ++i) { | 675 for (size_t i = 0; i < profiles.size(); ++i) { |
| 675 DownloadService* download_service = | 676 DownloadService* download_service = |
| 676 DownloadServiceFactory::GetForProfile(profiles[i]); | 677 DownloadServiceFactory::GetForProfile(profiles[i]); |
| 677 DownloadManager* download_manager = | 678 DownloadManager* download_manager = |
| 678 (download_service->HasCreatedDownloadManager() ? | 679 (download_service->HasCreatedDownloadManager() ? |
| 679 download_service->GetDownloadManager() : NULL); | 680 BrowserContext::GetDownloadManager(profiles[i]) : NULL); |
| 680 if (download_manager && download_manager->InProgressCount() > 0) { | 681 if (download_manager && download_manager->InProgressCount() > 0) { |
| 681 int downloadCount = download_manager->InProgressCount(); | 682 int downloadCount = download_manager->InProgressCount(); |
| 682 if ([self userWillWaitForInProgressDownloads:downloadCount]) { | 683 if ([self userWillWaitForInProgressDownloads:downloadCount]) { |
| 683 // Create a new browser window (if necessary) and navigate to the | 684 // Create a new browser window (if necessary) and navigate to the |
| 684 // downloads page if the user chooses to wait. | 685 // downloads page if the user chooses to wait. |
| 685 Browser* browser = browser::FindBrowserWithProfile(profiles[i]); | 686 Browser* browser = browser::FindBrowserWithProfile(profiles[i]); |
| 686 if (!browser) { | 687 if (!browser) { |
| 687 browser = Browser::Create(profiles[i]); | 688 browser = Browser::Create(profiles[i]); |
| 688 browser->window()->Show(); | 689 browser->window()->Show(); |
| 689 } | 690 } |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 | 1318 |
| 1318 } // namespace browser | 1319 } // namespace browser |
| 1319 | 1320 |
| 1320 namespace app_controller_mac { | 1321 namespace app_controller_mac { |
| 1321 | 1322 |
| 1322 bool IsOpeningNewWindow() { | 1323 bool IsOpeningNewWindow() { |
| 1323 return g_is_opening_new_window; | 1324 return g_is_opening_new_window; |
| 1324 } | 1325 } |
| 1325 | 1326 |
| 1326 } // namespace app_controller_mac | 1327 } // namespace app_controller_mac |
| OLD | NEW |