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..58254cdfda3f17292e1127a0f0eb0b316a7d458c 100644 |
--- a/chrome/browser/app_controller_mac.mm |
+++ b/chrome/browser/app_controller_mac.mm |
@@ -1280,18 +1280,29 @@ - (void)openUrls:(const std::vector<GURL>&)urls { |
return; |
} |
- Browser* browser = chrome::GetLastActiveBrowser(); |
- // 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)); |
- browser->window()->Show(); |
+ Profile* profile = [self lastProfile]; |
+ SessionStartupPref pref = StartupBrowserCreator::GetSessionStartupPref( |
+ *base::CommandLine::ForCurrentProcess(), profile); |
+ |
+ if (pref.type == SessionStartupPref::LAST && |
+ SessionRestore::IsRestoring(profile)) { |
+ // In case of session restore, remember |urls|, so they will be opened |
+ // after session is resored, in the tabs next to it. |
+ SessionRestore::AddURLsToOpen(profile, urls); |
+ } else { |
+ Browser* browser = chrome::GetLastActiveBrowser(); |
+ // if no browser window exists then create one with no tabs to be filled in |
Avi (use Gerrit)
2017/05/04 23:47:43
While you're here, turn this into a sentence with
eugenebng
2017/05/15 06:17:08
Done.
|
+ if (!browser && pref.type != SessionStartupPref::LAST) { |
Avi (use Gerrit)
2017/05/04 23:47:43
I'm not clear on this line. So if there is no brow
eugenebng
2017/05/15 06:17:08
Fixed this logic, so that it now handles 3 open UR
|
+ browser = new Browser(Browser::CreateParams([self lastProfile], true)); |
+ browser->window()->Show(); |
+ } |
+ 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); |
} |
- |
- 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 |