Chromium Code Reviews| 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) |