Commit 8ee1b8e5 authored by koz@chromium.org's avatar koz@chromium.org

Add UMA for register protocol handler.

BUG=92440

Review URL: http://codereview.chromium.org/7601021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96340 0039d316-1c4b-4281-b951-d872f2087c98
parent 6fd74888
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/user_metrics.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -69,11 +70,15 @@ bool RegisterProtocolHandlerInfoBarDelegate::NeedElevation( ...@@ -69,11 +70,15 @@ bool RegisterProtocolHandlerInfoBarDelegate::NeedElevation(
} }
bool RegisterProtocolHandlerInfoBarDelegate::Accept() { bool RegisterProtocolHandlerInfoBarDelegate::Accept() {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.Infobar_Accept"));
registry_->OnAcceptRegisterProtocolHandler(handler_); registry_->OnAcceptRegisterProtocolHandler(handler_);
return true; return true;
} }
bool RegisterProtocolHandlerInfoBarDelegate::Cancel() { bool RegisterProtocolHandlerInfoBarDelegate::Cancel() {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_Deny"));
registry_->OnIgnoreRegisterProtocolHandler(handler_); registry_->OnIgnoreRegisterProtocolHandler(handler_);
return true; return true;
} }
...@@ -84,6 +89,8 @@ string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const { ...@@ -84,6 +89,8 @@ string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const {
bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked( bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) { WindowOpenDisposition disposition) {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_LearnMore"));
tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL( tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL(
chrome::kLearnMoreRegisterProtocolHandlerURL)), GURL(), chrome::kLearnMoreRegisterProtocolHandlerURL)), GURL(),
(disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
......
...@@ -1355,6 +1355,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) { ...@@ -1355,6 +1355,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
if (handlers.empty()) { if (handlers.empty()) {
return; return;
} }
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.ContextMenu_Open"));
int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST; int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST;
OpenURL( OpenURL(
handlers[handlerIndex].TranslateUrl(params_.link_url), handlers[handlerIndex].TranslateUrl(params_.link_url),
...@@ -1677,6 +1679,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) { ...@@ -1677,6 +1679,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
break; break;
#endif // OS_MACOSX #endif // OS_MACOSX
case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: { case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.ContextMenu_Settings"));
std::string url = std::string(chrome::kChromeUISettingsURL) + std::string url = std::string(chrome::kChromeUISettingsURL) +
chrome::kHandlerSettingsSubPage; chrome::kHandlerSettingsSubPage;
OpenURL(GURL(url), GURL(), 0, NEW_FOREGROUND_TAB, PageTransition::LINK); OpenURL(GURL(url), GURL(), 0, NEW_FOREGROUND_TAB, PageTransition::LINK);
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
#include "content/browser/tab_contents/navigation_details.h" #include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h" #include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/user_metrics.h"
#include "content/common/notification_service.h" #include "content/common/notification_service.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
...@@ -585,6 +586,8 @@ void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, ...@@ -585,6 +586,8 @@ void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol,
if (!handler.IsEmpty() && if (!handler.IsEmpty() &&
registry->CanSchemeBeOverridden(handler.protocol())) { registry->CanSchemeBeOverridden(handler.protocol())) {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_Shown"));
AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(),
registry, registry,
handler)); handler));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment