Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 2798143004: Fix for URL opening code (Closed)
Patch Set: Fixed opening local file with Chromium on mac while restore session is enabled. File opens in the t… Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698