Index: chrome/browser/ui/startup/autolaunch_prompt_win.cc |
=================================================================== |
--- chrome/browser/ui/startup/autolaunch_prompt_win.cc (revision 175396) |
+++ chrome/browser/ui/startup/autolaunch_prompt_win.cc (working copy) |
@@ -36,12 +36,17 @@ |
// The delegate for the infobar shown when Chrome was auto-launched. |
class AutolaunchInfoBarDelegate : public ConfirmInfoBarDelegate { |
public: |
+ // Creates an autolaunch delegate and adds it to |infobar_service|. |
+ static void Create(InfoBarService* infobar_service, |
+ PrefService* prefs, |
+ Profile* profile); |
+ |
+ private: |
AutolaunchInfoBarDelegate(InfoBarService* infobar_service, |
PrefService* prefs, |
Profile* profile); |
virtual ~AutolaunchInfoBarDelegate(); |
- private: |
void AllowExpiry() { should_expire_ = true; } |
// ConfirmInfoBarDelegate: |
@@ -71,6 +76,14 @@ |
DISALLOW_COPY_AND_ASSIGN(AutolaunchInfoBarDelegate); |
}; |
+// static |
+void AutolaunchInfoBarDelegate::Create(InfoBarService* infobar_service, |
+ PrefService* prefs, |
+ Profile* profile) { |
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
+ new AutolaunchInfoBarDelegate(infobar_service, prefs, profile))); |
+} |
+ |
AutolaunchInfoBarDelegate::AutolaunchInfoBarDelegate( |
InfoBarService* infobar_service, |
PrefService* prefs, |
@@ -175,17 +188,10 @@ |
} |
content::WebContents* web_contents = chrome::GetActiveWebContents(browser); |
- |
- // Don't show the info-bar if there are already info-bars showing. |
- InfoBarService* infobar_service = |
- InfoBarService::FromWebContents(web_contents); |
- if (infobar_service->GetInfoBarCount() > 0) |
- return false; |
- |
profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
- infobar_service->AddInfoBar(new AutolaunchInfoBarDelegate( |
- infobar_service, profile->GetPrefs(), profile)); |
- |
+ AutolaunchInfoBarDelegate::Create( |
+ InfoBarService::FromWebContents(web_contents), profile->GetPrefs(), |
+ profile); |
return true; |
} |