| 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,
|
|
|