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

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

Issue 9317002: Make the auto-launch experiment profile-aware. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Uploading again post gclient sync (no other changes) Created 8 years, 11 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 119922)
+++ chrome/browser/ui/browser_init.cc (working copy)
@@ -141,7 +141,8 @@
class AutolaunchInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
AutolaunchInfoBarDelegate(InfoBarTabHelper* infobar_helper,
- PrefService* prefs);
+ PrefService* prefs,
+ Profile* profile);
virtual ~AutolaunchInfoBarDelegate();
private:
@@ -165,6 +166,8 @@
// Whether the info-bar should be dismissed on the next navigation.
bool should_expire_;
+ Profile* profile_;
+
// Used to delay the expiration of the info-bar.
base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_;
@@ -173,11 +176,13 @@
AutolaunchInfoBarDelegate::AutolaunchInfoBarDelegate(
InfoBarTabHelper* infobar_helper,
- PrefService* prefs)
+ PrefService* prefs,
+ Profile* profile)
: ConfirmInfoBarDelegate(infobar_helper),
prefs_(prefs),
action_taken_(false),
should_expire_(false),
+ profile_(profile),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
auto_launch_trial::UpdateInfobarShownMetric();
@@ -240,7 +245,7 @@
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
base::Bind(&auto_launch_util::SetWillLaunchAtLogin,
- auto_launch, FilePath()));
+ auto_launch, FilePath(), profile_->GetPath()));
return true;
}
@@ -363,7 +368,7 @@
infobar_helper->AddInfoBar(
new AutolaunchInfoBarDelegate(infobar_helper,
- tab->profile()->GetPrefs()));
+ tab->profile()->GetPrefs(), tab->profile()));
}
#endif
@@ -1485,6 +1490,10 @@
if (!auto_launch_trial::IsInAutoLaunchGroup())
return false;
+ // Only supported on the main profile for now.
+ if (profile->GetPath().BaseName().value() != ASCIIToUTF16("Default"))
grt (UTC plus 2) 2012/02/01 18:45:15 "Default" -> chrome::kInitialProfile
+ return false;
+
int infobar_shown =
profile->GetPrefs()->GetInteger(prefs::kShownAutoLaunchInfobar);
if (infobar_shown >= kMaxInfobarShown)

Powered by Google App Engine
This is Rietveld 408576698