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

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: Delete the Run key on profile deletion Created 8 years, 10 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 120769)
+++ 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,9 @@
// Whether the info-bar should be dismissed on the next navigation.
bool should_expire_;
+ // Weak pointer to the profile, not owned by us.
+ Profile* profile_;
+
// Used to delay the expiration of the info-bar.
base::WeakPtrFactory<AutolaunchInfoBarDelegate> weak_factory_;
@@ -173,11 +177,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 +246,9 @@
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
base::Bind(&auto_launch_util::SetWillLaunchAtLogin,
- auto_launch, FilePath()));
+ auto_launch,
+ FilePath(),
+ profile_->GetPath().BaseName().value()));
return true;
}
@@ -363,7 +371,7 @@
infobar_helper->AddInfoBar(
new AutolaunchInfoBarDelegate(infobar_helper,
- tab->profile()->GetPrefs()));
+ tab->profile()->GetPrefs(), tab->profile()));
}
#endif
@@ -1493,12 +1501,21 @@
if (!auto_launch_trial::IsInAutoLaunchGroup())
return false;
+ // Only supported on the main profile for now.
+ if (profile->GetPath().BaseName().value() !=
+ ASCIIToUTF16(chrome::kInitialProfile)) {
+ 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::kChromeFrame))
+ return false;
+
if (command_line.HasSwitch(switches::kAutoLaunchAtStartup) ||
first_run::IsChromeFirstRun()) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698