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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 9972012: Resolve the conflict that auto-launch has with the background mode feature (part 1). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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/ui/browser_init.cc
===================================================================
--- chrome/browser/ui/browser_init.cc (revision 132169)
+++ chrome/browser/ui/browser_init.cc (working copy)
@@ -257,10 +257,8 @@
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
- base::Bind(&auto_launch_util::SetWillLaunchAtLogin,
- auto_launch,
- FilePath(),
- profile_->GetPath().BaseName().value()));
+ base::Bind(&auto_launch_util::DisableAutoStartAtLogin,
+ profile_->GetPath().BaseName().value())); // Background mode.
Finnur 2012/04/16 18:09:07 Comment removed locally.
return true;
}
@@ -376,11 +374,13 @@
}
#if defined(OS_WIN)
-void CheckAutoLaunchCallback() {
+void CheckAutoLaunchCallback(Profile* profile) {
if (!auto_launch_trial::IsInAutoLaunchGroup())
return;
- Browser* browser = BrowserList::GetLastActive();
+ // We must not use GetLastActive here because this is at Chrome startup and
+ // no window might have been made active yet. We'll settle for any window.
+ Browser* browser = BrowserList::FindAnyBrowser(profile, true);
grt (UTC plus 2) 2012/04/16 19:43:58 Looks like this could potentially return NULL. Wi
Andrew T Wilson (Slow) 2012/04/16 22:57:33 Agreed. Do we know this is never called with no wi
Finnur 2012/04/17 12:27:45 Yes, this codepath doesn't execute when in backgro
TabContentsWrapper* tab = browser->GetSelectedTabContentsWrapper();
// Don't show the info-bar if there are already info-bars showing.
@@ -1073,9 +1073,13 @@
bool process_startup,
const std::vector<GURL>& urls_to_open) {
// If we're starting up in "background mode" (no open browser window) then
- // don't open any browser windows.
- if (process_startup && command_line_.HasSwitch(switches::kNoStartupWindow))
+ // don't open any browser windows, unless kAutoLaunchAtStartup is also
+ // specified.
+ if (process_startup &&
+ command_line_.HasSwitch(switches::kNoStartupWindow) &&
+ !command_line_.HasSwitch(switches::kAutoLaunchAtStartup)) {
return;
+ }
if (process_startup && ProcessStartupURLs(urls_to_open)) {
// ProcessStartupURLs processed the urls, nothing else to do.
@@ -1570,7 +1574,7 @@
if (command_line.HasSwitch(switches::kAutoLaunchAtStartup) ||
first_run::IsChromeFirstRun()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&CheckAutoLaunchCallback));
+ base::Bind(&CheckAutoLaunchCallback, profile));
return true;
}
#endif
@@ -1721,7 +1725,8 @@
// If there are any extra parameters, we expect each one to generate a
// new tab; if there are none then we get one homepage tab.
int expected_tab_count = 1;
- if (command_line.HasSwitch(switches::kNoStartupWindow)) {
+ if (command_line.HasSwitch(switches::kNoStartupWindow) &&
+ !command_line.HasSwitch(switches::kAutoLaunchAtStartup)) {
expected_tab_count = 0;
#if defined(OS_CHROMEOS)
// kLoginManager will cause Chrome to start up with the ChromeOS login

Powered by Google App Engine
This is Rietveld 408576698