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 <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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1261 | 1261 |
| 1262 const PrefService* prefs = g_browser_process->local_state(); | 1262 const PrefService* prefs = g_browser_process->local_state(); |
| 1263 return !profile->IsGuestSession() || | 1263 return !profile->IsGuestSession() || |
| 1264 prefs->GetBoolean(prefs::kBrowserGuestModeEnabled); | 1264 prefs->GetBoolean(prefs::kBrowserGuestModeEnabled); |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 // Various methods to open URLs that we get in a native fashion. We use | 1267 // Various methods to open URLs that we get in a native fashion. We use |
| 1268 // StartupBrowserCreator here because on the other platforms, URLs to open come | 1268 // StartupBrowserCreator here because on the other platforms, URLs to open come |
| 1269 // through the ProcessSingleton, and it calls StartupBrowserCreator. It's best | 1269 // through the ProcessSingleton, and it calls StartupBrowserCreator. It's best |
| 1270 // to bottleneck the openings through that for uniform handling. | 1270 // to bottleneck the openings through that for uniform handling. |
| 1271 - (void)openUrls:(const std::vector<GURL>&)urls { | 1271 - (void)openUrls:(const std::vector<GURL>&)urls { |
|
sky
2017/04/07 21:52:14
I'm not familiar with the startup sequence on the
eugenebng
2017/04/10 11:54:08
This happens before session restore.
To be more de
| |
| 1272 if (!startupComplete_) { | 1272 if (!startupComplete_) { |
| 1273 startupUrls_.insert(startupUrls_.end(), urls.begin(), urls.end()); | 1273 startupUrls_.insert(startupUrls_.end(), urls.begin(), urls.end()); |
| 1274 return; | 1274 return; |
| 1275 } | 1275 } |
| 1276 | 1276 |
| 1277 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | |
| 1278 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | |
| 1279 StartupBrowserCreatorImpl launch(base::FilePath(), | |
| 1280 *base::CommandLine::ForCurrentProcess(), | |
| 1281 first_run); | |
| 1277 Browser* browser = chrome::GetLastActiveBrowser(); | 1282 Browser* browser = chrome::GetLastActiveBrowser(); |
| 1278 // if no browser window exists then create one with no tabs to be filled in | 1283 bool show_browser = false; |
| 1279 if (!browser) { | 1284 if (!browser) { |
| 1280 browser = new Browser(Browser::CreateParams([self lastProfile], true)); | 1285 browser = new Browser(Browser::CreateParams([self lastProfile], true)); |
| 1281 browser->window()->Show(); | 1286 show_browser = true; |
| 1282 } | 1287 } |
| 1283 | 1288 if (launch.WillRestoreSession(browser, [self lastProfile], false, urls)) { |
| 1284 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); | 1289 launch.OpenURLsAfterSessionRestore(browser, false, urls); |
| 1285 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1290 } else { |
| 1286 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; | 1291 // if no browser window exists then create one with no tabs to be filled in |
| 1287 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); | 1292 if (show_browser) |
| 1288 launch.OpenURLsInBrowser(browser, false, urls); | 1293 browser->window()->Show(); |
| 1294 launch.OpenURLsInBrowser(browser, false, urls); | |
| 1295 } | |
| 1289 } | 1296 } |
| 1290 | 1297 |
| 1291 - (void)getUrl:(NSAppleEventDescriptor*)event | 1298 - (void)getUrl:(NSAppleEventDescriptor*)event |
| 1292 withReply:(NSAppleEventDescriptor*)reply { | 1299 withReply:(NSAppleEventDescriptor*)reply { |
| 1293 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] | 1300 NSString* urlStr = [[event paramDescriptorForKeyword:keyDirectObject] |
| 1294 stringValue]; | 1301 stringValue]; |
| 1295 | 1302 |
| 1296 GURL gurl(base::SysNSStringToUTF8(urlStr)); | 1303 GURL gurl(base::SysNSStringToUTF8(urlStr)); |
| 1297 std::vector<GURL> gurlVector; | 1304 std::vector<GURL> gurlVector; |
| 1298 gurlVector.push_back(gurl); | 1305 gurlVector.push_back(gurl); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1602 | 1609 |
| 1603 //--------------------------------------------------------------------------- | 1610 //--------------------------------------------------------------------------- |
| 1604 | 1611 |
| 1605 namespace app_controller_mac { | 1612 namespace app_controller_mac { |
| 1606 | 1613 |
| 1607 bool IsOpeningNewWindow() { | 1614 bool IsOpeningNewWindow() { |
| 1608 return g_is_opening_new_window; | 1615 return g_is_opening_new_window; |
| 1609 } | 1616 } |
| 1610 | 1617 |
| 1611 } // namespace app_controller_mac | 1618 } // namespace app_controller_mac |
| OLD | NEW |