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

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

Issue 8969024: Make sure the Autolaunch infobar... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 114621)
+++ chrome/browser/ui/browser_init.cc (working copy)
@@ -36,6 +36,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/pack_extension_job.h"
#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/net/crl_set_fetcher.h"
#include "chrome/browser/net/predictor.h"
@@ -343,18 +344,17 @@
#if defined(OS_WIN)
void CheckAutoLaunchCallback() {
- if (!auto_launch_trial::IsInAutoLaunchGroup())
+ if (!auto_launch_trial::IsInAutoLaunchFieldTrial())
return;
Browser* browser = BrowserList::GetLastActive();
TabContentsWrapper* tab = browser->GetSelectedTabContentsWrapper();
- int infobar_shown =
- tab->profile()->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar);
- if (infobar_shown >= kMaxInfobarShown)
+ // Don't show the info-bar if there are already info-bars showing.
+ InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
+ if (infobar_helper->infobar_count() > 0)
return;
- InfoBarTabHelper* infobar_helper = tab->infobar_tab_helper();
infobar_helper->AddInfoBar(
new AutolaunchInfoBarDelegate(infobar_helper,
tab->profile()->GetPrefs()));
@@ -843,10 +843,10 @@
if (process_startup) {
if (browser_defaults::kOSSupportsOtherBrowsers &&
!command_line_.HasSwitch(switches::kNoDefaultBrowserCheck)) {
- CheckIfAutoLaunched(profile);
-
- // Check whether we are the default browser.
- CheckDefaultBrowser(profile);
+ if (!CheckIfAutoLaunched(profile)) {
+ // Check whether we are the default browser.
+ CheckDefaultBrowser(profile);
+ }
}
#if defined(OS_MACOSX)
// Check whether the auto-update system needs to be promoted from user
@@ -1455,16 +1455,25 @@
BrowserThread::FILE, FROM_HERE, base::Bind(&CheckDefaultBrowserCallback));
}
-void BrowserInit::LaunchWithProfile::CheckIfAutoLaunched(Profile* profile) {
+bool BrowserInit::LaunchWithProfile::CheckIfAutoLaunched(Profile* profile) {
#if defined(OS_WIN)
- if (!auto_launch_trial::IsInAutoLaunchGroup())
- return;
+ if (!auto_launch_trial::IsInAutoLaunchFieldTrial())
+ return false;
+ int infobar_shown =
+ profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar);
+ if (infobar_shown >= kMaxInfobarShown)
+ return false;
+
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kAutoLaunchAtStartup)) {
+ if (command_line.HasSwitch(switches::kAutoLaunchAtStartup) ||
+ FirstRun::IsChromeFirstRun()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
base::Bind(&CheckAutoLaunchCallback));
+ return true;
}
+
+ return false;
#endif
}

Powered by Google App Engine
This is Rietveld 408576698