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

Unified Diff: chrome/browser/ui/startup/default_browser_prompt.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/startup/bad_flags_prompt.cc ('k') | chrome/browser/ui/startup/obsolete_os_info_bar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/default_browser_prompt.cc
===================================================================
--- chrome/browser/ui/startup/default_browser_prompt.cc (revision 175396)
+++ chrome/browser/ui/startup/default_browser_prompt.cc (working copy)
@@ -55,11 +55,15 @@
// The delegate for the infobar shown when Chrome is not the default browser.
class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
+ // Creates a default browser delegate and adds it to |infobar_service|.
+ static void Create(InfoBarService* infobar_service,
+ PrefService* prefs,
+ bool interactive_flow_required);
+
+ private:
DefaultBrowserInfoBarDelegate(InfoBarService* infobar_service,
PrefService* prefs,
bool interactive_flow_required);
-
- private:
virtual ~DefaultBrowserInfoBarDelegate();
void AllowExpiry() { should_expire_ = true; }
@@ -93,6 +97,15 @@
DISALLOW_COPY_AND_ASSIGN(DefaultBrowserInfoBarDelegate);
};
+// static
+void DefaultBrowserInfoBarDelegate::Create(InfoBarService* infobar_service,
+ PrefService* prefs,
+ bool interactive_flow_required) {
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new DefaultBrowserInfoBarDelegate(infobar_service, prefs,
+ interactive_flow_required)));
+}
+
DefaultBrowserInfoBarDelegate::DefaultBrowserInfoBarDelegate(
InfoBarService* infobar_service,
PrefService* prefs,
@@ -171,20 +184,13 @@
if (!web_contents)
return;
- // 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;
-
bool interactive_flow = ShellIntegration::CanSetAsDefaultBrowser() ==
ShellIntegration::SET_DEFAULT_INTERACTIVE;
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- infobar_service->AddInfoBar(
- new DefaultBrowserInfoBarDelegate(infobar_service,
- profile->GetPrefs(),
- interactive_flow));
+ DefaultBrowserInfoBarDelegate::Create(
+ InfoBarService::FromWebContents(web_contents), profile->GetPrefs(),
+ interactive_flow);
}
void CheckDefaultBrowserCallback(chrome::HostDesktopType desktop_type) {
« no previous file with comments | « chrome/browser/ui/startup/bad_flags_prompt.cc ('k') | chrome/browser/ui/startup/obsolete_os_info_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698