Index: chrome/browser/app_controller_mac.mm |
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm |
index f6e6ec5789882d8e481490891267886b5720e671..79da0d189751ec8971af856da4d838b049aa54fe 100644 |
--- a/chrome/browser/app_controller_mac.mm |
+++ b/chrome/browser/app_controller_mac.mm |
@@ -1279,19 +1279,32 @@ - (void)openUrls:(const std::vector<GURL>&)urls { |
startupUrls_.insert(startupUrls_.end(), urls.begin(), urls.end()); |
return; |
} |
- |
Browser* browser = chrome::GetLastActiveBrowser(); |
+ bool show_browser = false; |
// if no browser window exists then create one with no tabs to be filled in |
if (!browser) { |
browser = new Browser(Browser::CreateParams([self lastProfile], true)); |
sky
2017/04/28 17:34:58
Why do we need to open a browser here if triggerin
eugenebng
2017/05/03 16:05:30
Initially I was going to change as few as possible
|
- browser->window()->Show(); |
+ show_browser = true; |
+ } |
+ Profile* profile = [self lastProfile]; |
+ SessionStartupPref pref = StartupBrowserCreator::GetSessionStartupPref( |
+ *base::CommandLine::ForCurrentProcess(), profile); |
+ |
+ if (pref.type == SessionStartupPref::LAST) { |
+ // In case of session restore, remember |urls|, so they will be opened |
+ // after session is resored, in the tabs next to it. |
+ DCHECK(SessionRestore::IsRestoring(profile)); |
+ SessionRestore::AddURLsToOpen(profile, urls); |
+ } else { |
+ base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
+ chrome::startup::IsFirstRun first_run = |
+ first_run::IsChromeFirstRun() ? chrome::startup::IS_FIRST_RUN |
+ : chrome::startup::IS_NOT_FIRST_RUN; |
+ StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); |
+ if (show_browser) |
+ browser->window()->Show(); |
+ launch.OpenURLsInBrowser(browser, false, urls); |
} |
- |
- base::CommandLine dummy(base::CommandLine::NO_PROGRAM); |
- chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
- chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
- StartupBrowserCreatorImpl launch(base::FilePath(), dummy, first_run); |
- launch.OpenURLsInBrowser(browser, false, urls); |
} |
- (void)getUrl:(NSAppleEventDescriptor*)event |