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

Unified Diff: chrome/browser/ui/startup/autolaunch_prompt_win.cc

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/ui/media_stream_infobar_delegate.cc ('k') | chrome/browser/ui/startup/bad_flags_prompt.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/ui/media_stream_infobar_delegate.cc ('k') | chrome/browser/ui/startup/bad_flags_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698