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

Unified Diff: chrome/browser/managed_mode/managed_mode_navigation_observer.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
Index: chrome/browser/managed_mode/managed_mode_navigation_observer.cc
===================================================================
--- chrome/browser/managed_mode/managed_mode_navigation_observer.cc (revision 175396)
+++ chrome/browser/managed_mode/managed_mode_navigation_observer.cc (working copy)
@@ -22,9 +22,12 @@
class ManagedModeWarningInfobarDelegate : public ConfirmInfoBarDelegate {
public:
- explicit ManagedModeWarningInfobarDelegate(InfoBarService* infobar_service);
+ // Creates a managed mode warning delegate and adds it to |infobar_service|.
+ // Returns the delegate if it was successfully added.
+ static InfoBarDelegate* Create(InfoBarService* infobar_service);
private:
+ explicit ManagedModeWarningInfobarDelegate(InfoBarService* infobar_service);
virtual ~ManagedModeWarningInfobarDelegate();
// ConfirmInfoBarDelegate overrides:
@@ -64,6 +67,13 @@
web_contents->GetDelegate()->CloseContents(web_contents);
}
+// static
+InfoBarDelegate* ManagedModeWarningInfobarDelegate::Create(
+ InfoBarService* infobar_service) {
+ return infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new ManagedModeWarningInfobarDelegate(infobar_service)));
+}
+
ManagedModeWarningInfobarDelegate::ManagedModeWarningInfobarDelegate(
InfoBarService* infobar_service)
: ConfirmInfoBarDelegate(infobar_service) {}
@@ -138,11 +148,8 @@
if (behavior == ManagedModeURLFilter::WARN) {
if (!warn_infobar_delegate_) {
- InfoBarService* infobar_service =
- InfoBarService::FromWebContents(web_contents());
- warn_infobar_delegate_ =
- new ManagedModeWarningInfobarDelegate(infobar_service);
- infobar_service->AddInfoBar(warn_infobar_delegate_);
+ warn_infobar_delegate_ = ManagedModeWarningInfobarDelegate::Create(
+ InfoBarService::FromWebContents(web_contents()));
}
} else {
if (warn_infobar_delegate_) {
« no previous file with comments | « chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc ('k') | chrome/browser/nacl_host/nacl_infobar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698