Index: chrome/browser/app_controller_mac.mm |
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm |
index 78d27e24bfe65d7ece00191b85791a9638cee468..ad8a78a8ac79757d4b0ce8e42b4aa9e4ddf4862f 100644 |
--- a/chrome/browser/app_controller_mac.mm |
+++ b/chrome/browser/app_controller_mac.mm |
@@ -1273,19 +1273,31 @@ class AppControllerProfileObserver : public ProfileAttributesStorage::Observer { |
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)); |
- browser->window()->Show(); |
+ show_browser = true; |
} |
+ Profile* profile = [self lastProfile]; |
+ SessionStartupPref pref = StartupBrowserCreator::GetSessionStartupPref( |
+ *base::CommandLine::ForCurrentProcess(), profile); |
- 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); |
+ 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. |
+ StartupBrowserCreatorImpl::OpenURLsAfterSessionRestore(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); |
+ } |
} |
- (void)getUrl:(NSAppleEventDescriptor*)event |