From 244d7c5866e4c7406251a499272abd76204fa005 Mon Sep 17 00:00:00 2001 From: "tsepez@chromium.org" Date: Mon, 13 Jun 2011 22:28:56 +0000 Subject: Update learn more URLs to point to acutal locations, add histograms, remove unused methods. Review URL: http://codereview.chromium.org/6995144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88914 0039d316-1c4b-4281-b951-d872f2087c98 --- .../tab_contents/blocked_infobar_delegate.cc | 53 ++++++++++++++++++++-- .../tab_contents/blocked_infobar_delegate.h | 9 ++-- 2 files changed, 54 insertions(+), 8 deletions(-) (limited to 'chrome/browser/tab_contents') diff --git a/chrome/browser/tab_contents/blocked_infobar_delegate.cc b/chrome/browser/tab_contents/blocked_infobar_delegate.cc index 425ab18..4da80c1 100644 --- a/chrome/browser/tab_contents/blocked_infobar_delegate.cc +++ b/chrome/browser/tab_contents/blocked_infobar_delegate.cc @@ -3,12 +3,32 @@ // found in the LICENSE file. #include "chrome/browser/tab_contents/blocked_infobar_delegate.h" + +#include "base/metrics/histogram.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/render_messages.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +namespace { + +enum BlockedInfoBarEvent { + BLOCKED_INFOBAR_EVENT_SHOWN = 0, // Infobar was added to the tab. + BLOCKED_INFOBAR_EVENT_ALLOWED, // User clicked allowed anyay button. + BLOCKED_INFOBAR_EVENT_CANCELLED, // Reserved (if future cancel button). + BLOCKED_INFOBAR_EVENT_DISMISSED, // User clicked "x" to dismiss bar. + BLOCKED_INFOBAR_EVENT_LAST // First unused value. +}; + +const char kDisplayingLearnMoreURL[] = + "https://www.google.com/support/chrome/bin/answer.py?answer=1342710"; + +const char kRunningLearnMoreURL[] = + "https://www.google.com/support/chrome/bin/answer.py?answer=1342714"; + +} // namespace + BlockedInfoBarDelegate::BlockedInfoBarDelegate(TabContentsWrapper* wrapper, int message_resource_id, int button_resource_id, @@ -17,7 +37,8 @@ BlockedInfoBarDelegate::BlockedInfoBarDelegate(TabContentsWrapper* wrapper, wrapper_(wrapper), message_resource_id_(message_resource_id), button_resource_id_(button_resource_id), - url_(url) {} + url_(url) { +} BlockedInfoBarDelegate* BlockedInfoBarDelegate::AsBlockedInfoBarDelegate() { return this; @@ -57,10 +78,23 @@ BlockedDisplayingInfoBarDelegate::BlockedDisplayingInfoBarDelegate( wrapper, IDS_BLOCKED_DISPLAYING_INSECURE_CONTENT, IDS_ALLOW_INSECURE_CONTENT_BUTTON, - GURL("http://www.google.com?q=blocked+display")) { + GURL(kDisplayingLearnMoreURL)) { + UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar", + BLOCKED_INFOBAR_EVENT_SHOWN, + BLOCKED_INFOBAR_EVENT_LAST); +} + +void BlockedDisplayingInfoBarDelegate::InfoBarDismissed() { + UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar", + BLOCKED_INFOBAR_EVENT_DISMISSED, + BLOCKED_INFOBAR_EVENT_LAST); + InfoBarDelegate::InfoBarDismissed(); } bool BlockedDisplayingInfoBarDelegate::Accept() { + UMA_HISTOGRAM_ENUMERATION("MixedContent.DisplayingInfoBar", + BLOCKED_INFOBAR_EVENT_ALLOWED, + BLOCKED_INFOBAR_EVENT_LAST); wrapper()->Send(new ViewMsg_SetAllowDisplayingInsecureContent( wrapper()->routing_id(), true)); return true; @@ -72,7 +106,10 @@ BlockedRunningInfoBarDelegate::BlockedRunningInfoBarDelegate( wrapper, IDS_BLOCKED_RUNNING_INSECURE_CONTENT, IDS_ALLOW_INSECURE_CONTENT_BUTTON, - GURL("http://www.google.com?q=blocked+running")) { + GURL(kRunningLearnMoreURL)) { + UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar", + BLOCKED_INFOBAR_EVENT_SHOWN, + BLOCKED_INFOBAR_EVENT_LAST); } BlockedRunningInfoBarDelegate* @@ -80,7 +117,17 @@ BlockedRunningInfoBarDelegate::AsBlockedRunningInfoBarDelegate() { return this; } +void BlockedRunningInfoBarDelegate::InfoBarDismissed() { + UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar", + BLOCKED_INFOBAR_EVENT_DISMISSED, + BLOCKED_INFOBAR_EVENT_LAST); + InfoBarDelegate::InfoBarDismissed(); +} + bool BlockedRunningInfoBarDelegate::Accept() { + UMA_HISTOGRAM_ENUMERATION("MixedContent.RunningInfoBar", + BLOCKED_INFOBAR_EVENT_ALLOWED, + BLOCKED_INFOBAR_EVENT_LAST); wrapper()->Send(new ViewMsg_SetAllowRunningInsecureContent( wrapper()->routing_id(), true)); return true; diff --git a/chrome/browser/tab_contents/blocked_infobar_delegate.h b/chrome/browser/tab_contents/blocked_infobar_delegate.h index c6e080c..591ed2a 100644 --- a/chrome/browser/tab_contents/blocked_infobar_delegate.h +++ b/chrome/browser/tab_contents/blocked_infobar_delegate.h @@ -25,11 +25,6 @@ class BlockedInfoBarDelegate : public ConfirmInfoBarDelegate { int button_resource_id, const GURL& url); - // Returns the |message_resource_id| with which the infobar was created. - // Useful for determining how many infobars with this same message text - // are already present. - int message_resource_id() const { return message_resource_id_; } - // Type-checking downcast routine. virtual BlockedRunningInfoBarDelegate* AsBlockedRunningInfoBarDelegate(); @@ -57,6 +52,8 @@ class BlockedInfoBarDelegate : public ConfirmInfoBarDelegate { class BlockedDisplayingInfoBarDelegate : public BlockedInfoBarDelegate { public: explicit BlockedDisplayingInfoBarDelegate(TabContentsWrapper* wrapper); + private: + virtual void InfoBarDismissed() OVERRIDE; virtual bool Accept() OVERRIDE; }; @@ -66,6 +63,8 @@ class BlockedRunningInfoBarDelegate : public BlockedInfoBarDelegate { explicit BlockedRunningInfoBarDelegate(TabContentsWrapper* wrapper); virtual BlockedRunningInfoBarDelegate* AsBlockedRunningInfoBarDelegate() OVERRIDE; + private: + virtual void InfoBarDismissed() OVERRIDE; virtual bool Accept() OVERRIDE; }; -- cgit v1.1