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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 DownloadManager* download_manager = | 668 DownloadManager* download_manager = |
669 (download_service->HasCreatedDownloadManager() ? | 669 (download_service->HasCreatedDownloadManager() ? |
670 BrowserContext::GetDownloadManager(profiles[i]) : NULL); | 670 BrowserContext::GetDownloadManager(profiles[i]) : NULL); |
671 if (download_manager && download_manager->InProgressCount() > 0) { | 671 if (download_manager && download_manager->InProgressCount() > 0) { |
672 int downloadCount = download_manager->InProgressCount(); | 672 int downloadCount = download_manager->InProgressCount(); |
673 if ([self userWillWaitForInProgressDownloads:downloadCount]) { | 673 if ([self userWillWaitForInProgressDownloads:downloadCount]) { |
674 // Create a new browser window (if necessary) and navigate to the | 674 // Create a new browser window (if necessary) and navigate to the |
675 // downloads page if the user chooses to wait. | 675 // downloads page if the user chooses to wait. |
676 Browser* browser = browser::FindBrowserWithProfile(profiles[i]); | 676 Browser* browser = browser::FindBrowserWithProfile(profiles[i]); |
677 if (!browser) { | 677 if (!browser) { |
678 browser = Browser::Create(profiles[i]); | 678 browser = new Browser(Browser::CreateParams(profiles[i])); |
679 browser->window()->Show(); | 679 browser->window()->Show(); |
680 } | 680 } |
681 DCHECK(browser); | 681 DCHECK(browser); |
682 chrome::ShowDownloads(browser); | 682 chrome::ShowDownloads(browser); |
683 return NO; | 683 return NO; |
684 } | 684 } |
685 | 685 |
686 // User wants to exit. | 686 // User wants to exit. |
687 return YES; | 687 return YES; |
688 } | 688 } |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 - (void)openUrls:(const std::vector<GURL>&)urls { | 1086 - (void)openUrls:(const std::vector<GURL>&)urls { |
1087 // If the browser hasn't started yet, just queue up the URLs. | 1087 // If the browser hasn't started yet, just queue up the URLs. |
1088 if (!startupComplete_) { | 1088 if (!startupComplete_) { |
1089 startupUrls_.insert(startupUrls_.end(), urls.begin(), urls.end()); | 1089 startupUrls_.insert(startupUrls_.end(), urls.begin(), urls.end()); |
1090 return; | 1090 return; |
1091 } | 1091 } |
1092 | 1092 |
1093 Browser* browser = browser::GetLastActiveBrowser(); | 1093 Browser* browser = browser::GetLastActiveBrowser(); |
1094 // if no browser window exists then create one with no tabs to be filled in | 1094 // if no browser window exists then create one with no tabs to be filled in |
1095 if (!browser) { | 1095 if (!browser) { |
1096 browser = Browser::Create([self lastProfile]); | 1096 browser = new Browser(Browser::CreateParams([self lastProfile])); |
1097 browser->window()->Show(); | 1097 browser->window()->Show(); |
1098 } | 1098 } |
1099 | 1099 |
1100 CommandLine dummy(CommandLine::NO_PROGRAM); | 1100 CommandLine dummy(CommandLine::NO_PROGRAM); |
1101 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1101 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
1102 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 1102 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
1103 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); | 1103 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
1104 launch.OpenURLsInBrowser(browser, false, urls); | 1104 launch.OpenURLsInBrowser(browser, false, urls); |
1105 } | 1105 } |
1106 | 1106 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1308 | 1308 |
1309 } // namespace browser | 1309 } // namespace browser |
1310 | 1310 |
1311 namespace app_controller_mac { | 1311 namespace app_controller_mac { |
1312 | 1312 |
1313 bool IsOpeningNewWindow() { | 1313 bool IsOpeningNewWindow() { |
1314 return g_is_opening_new_window; | 1314 return g_is_opening_new_window; |
1315 } | 1315 } |
1316 | 1316 |
1317 } // namespace app_controller_mac | 1317 } // namespace app_controller_mac |
OLD | NEW |