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

Unified Diff: chrome/browser/infobars/insecure_content_infobar_delegate.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/infobars/insecure_content_infobar_delegate.cc
===================================================================
--- chrome/browser/infobars/insecure_content_infobar_delegate.cc (revision 175396)
+++ chrome/browser/infobars/insecure_content_infobar_delegate.cc (working copy)
@@ -16,14 +16,37 @@
using content::OpenURLParams;
+// static
+void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service,
+ InfoBarType type) {
+ scoped_ptr<InfoBarDelegate> new_infobar(
+ new InsecureContentInfoBarDelegate(infobar_service, type));
+
+ // Only supsersede an existing insecure content infobar if we are upgrading
+ // from DISPLAY to RUN.
+ for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) {
+ InsecureContentInfoBarDelegate* delegate = infobar_service->
+ GetInfoBarDelegateAt(i)->AsInsecureContentInfoBarDelegate();
+ if (delegate != NULL) {
+ if ((type == RUN) && (delegate->type_ == DISPLAY))
+ return;
+ infobar_service->ReplaceInfoBar(delegate, new_infobar.Pass());
+ break;
+ }
+ }
+ if (new_infobar.get())
+ infobar_service->AddInfoBar(new_infobar.Pass());
+
+ UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2",
+ (type == DISPLAY) ? DISPLAY_INFOBAR_SHOWN : RUN_INFOBAR_SHOWN,
+ NUM_EVENTS);
+}
+
InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate(
InfoBarService* infobar_service,
InfoBarType type)
: ConfirmInfoBarDelegate(infobar_service),
type_(type) {
- UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2",
- (type_ == DISPLAY) ? DISPLAY_INFOBAR_SHOWN : RUN_INFOBAR_SHOWN,
- NUM_EVENTS);
}
InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() {
« no previous file with comments | « chrome/browser/infobars/insecure_content_infobar_delegate.h ('k') | chrome/browser/intents/register_intent_handler_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698