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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator_impl.cc

Issue 1044523002: Linux: Fix regression with --kiosk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/ui/startup/startup_browser_creator_impl.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index 355fbe3876506bc5b300128042bfabd6767b1aee..d36078fbc90ad0bbbabf4c97ee9e4dbf214d6a18 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -355,14 +355,15 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile,
// not as chrome.
// Special case is when app switches are passed but we do want to restore
// session. In that case open app window + focus it after session is restored.
- content::WebContents* app_contents = NULL;
+ content::WebContents* app_contents = nullptr;
+ Browser* browser = nullptr;
if (OpenApplicationWindow(profile, &app_contents)) {
RecordLaunchModeHistogram(LM_AS_WEBAPP);
} else {
RecordLaunchModeHistogram(urls_to_open.empty() ?
LM_TO_BE_DECIDED : LM_WITH_URLS);
- ProcessLaunchURLs(process_startup, urls_to_open, desktop_type);
+ browser = ProcessLaunchURLs(process_startup, urls_to_open, desktop_type);
if (command_line_.HasSwitch(switches::kInstallChromeApp)) {
install_chrome_app::InstallChromeApp(
@@ -389,7 +390,6 @@ bool StartupBrowserCreatorImpl::Launch(Profile* profile,
// It's possible for there to be no browser window, e.g. if someone
// specified a non-sensical combination of options
// ("--kiosk --no_startup_window"); do nothing in that case.
- Browser* browser = BrowserList::GetInstance(desktop_type)->GetLastActive();
if (browser)
chrome::ToggleFullscreenMode(browser);
}
@@ -522,7 +522,7 @@ bool StartupBrowserCreatorImpl::OpenApplicationWindow(
return false;
}
-void StartupBrowserCreatorImpl::ProcessLaunchURLs(
+Browser* StartupBrowserCreatorImpl::ProcessLaunchURLs(
bool process_startup,
const std::vector<GURL>& urls_to_open,
chrome::HostDesktopType desktop_type) {
@@ -532,7 +532,7 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs(
if (process_startup &&
command_line_.HasSwitch(switches::kNoStartupWindow) &&
!command_line_.HasSwitch(switches::kAutoLaunchAtStartup)) {
- return;
+ return nullptr;
}
// TODO(tapted): Move this to startup_browser_creator_win.cc after refactor.
@@ -544,9 +544,12 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs(
}
#endif
- if (process_startup && ProcessStartupURLs(urls_to_open, desktop_type)) {
- // ProcessStartupURLs processed the urls, nothing else to do.
- return;
+ if (process_startup) {
+ Browser* browser = ProcessStartupURLs(urls_to_open, desktop_type);
+ if (browser) {
+ // ProcessStartupURLs processed the urls, nothing else to do.
+ return browser;
+ }
}
chrome::startup::IsProcessStartup is_process_startup = process_startup ?
@@ -564,19 +567,19 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs(
// Restore the last session if any.
if (!HasPendingUncleanExit(profile_) &&
service->RestoreIfNecessary(urls_to_open)) {
- return;
+ return nullptr;
}
// Open user-specified URLs like pinned tabs and startup tabs.
Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type);
if (browser) {
AddInfoBarsIfNecessary(browser, is_process_startup);
- return;
+ return browser;
}
}
}
// Session startup didn't occur, open the urls.
- Browser* browser = NULL;
+ Browser* browser = nullptr;
std::vector<GURL> adjust_urls = urls_to_open;
if (adjust_urls.empty()) {
AddStartupURLs(&adjust_urls);
@@ -591,9 +594,10 @@ void StartupBrowserCreatorImpl::ProcessLaunchURLs(
desktop_type);
StartupBrowserCreator::in_synchronous_profile_launch_ = false;
AddInfoBarsIfNecessary(browser, is_process_startup);
+ return browser;
}
-bool StartupBrowserCreatorImpl::ProcessStartupURLs(
+Browser* StartupBrowserCreatorImpl::ProcessStartupURLs(
const std::vector<GURL>& urls_to_open,
chrome::HostDesktopType desktop_type) {
VLOG(1) << "StartupBrowserCreatorImpl::ProcessStartupURLs";
@@ -622,7 +626,7 @@ bool StartupBrowserCreatorImpl::ProcessStartupURLs(
// To avoid this, don't restore on startup but instead show the crashed
// infobar.
VLOG(1) << "Unclean exit; not processing";
- return false;
+ return nullptr;
}
uint32 restore_behavior = SessionRestore::SYNCHRONOUS;
@@ -649,12 +653,12 @@ bool StartupBrowserCreatorImpl::ProcessStartupURLs(
urls_to_open);
AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
- return true;
+ return browser;
}
Browser* browser = ProcessSpecifiedURLs(urls_to_open, desktop_type);
if (!browser)
- return false;
+ return nullptr;
AddInfoBarsIfNecessary(browser, chrome::startup::IS_PROCESS_STARTUP);
@@ -667,7 +671,7 @@ bool StartupBrowserCreatorImpl::ProcessStartupURLs(
GetDOMStorageContext()->StartScavengingUnusedSessionStorage();
}
- return true;
+ return browser;
}
Browser* StartupBrowserCreatorImpl::ProcessSpecifiedURLs(

Powered by Google App Engine
This is Rietveld 408576698