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 @@
#include "chrome/browser/google/google_util.h"
#include "chrome/common/url_constants.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/user_metrics.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -69,11 +70,15 @@ bool RegisterProtocolHandlerInfoBarDelegate::NeedElevation(
}
bool RegisterProtocolHandlerInfoBarDelegate::Accept() {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.Infobar_Accept"));
registry_->OnAcceptRegisterProtocolHandler(handler_);
return true;
}
bool RegisterProtocolHandlerInfoBarDelegate::Cancel() {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_Deny"));
registry_->OnIgnoreRegisterProtocolHandler(handler_);
return true;
}
......@@ -84,6 +89,8 @@ string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const {
bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked(
WindowOpenDisposition disposition) {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_LearnMore"));
tab_contents_->OpenURL(google_util::AppendGoogleLocaleParam(GURL(
chrome::kLearnMoreRegisterProtocolHandlerURL)), GURL(),
(disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
......
......@@ -1355,6 +1355,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
if (handlers.empty()) {
return;
}
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.ContextMenu_Open"));
int handlerIndex = id - IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST;
OpenURL(
handlers[handlerIndex].TranslateUrl(params_.link_url),
......@@ -1677,6 +1679,8 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
break;
#endif // OS_MACOSX
case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.ContextMenu_Settings"));
std::string url = std::string(chrome::kChromeUISettingsURL) +
chrome::kHandlerSettingsSubPage;
OpenURL(GURL(url), GURL(), 0, NEW_FOREGROUND_TAB, PageTransition::LINK);
......
......@@ -62,6 +62,7 @@
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/tab_contents.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/view_messages.h"
#include "grit/generated_resources.h"
......@@ -585,6 +586,8 @@ void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol,
if (!handler.IsEmpty() &&
registry->CanSchemeBeOverridden(handler.protocol())) {
UserMetrics::RecordAction(UserMetricsAction(
"RegisterProtocolHandler.InfoBar_Shown"));
AddInfoBar(new RegisterProtocolHandlerInfoBarDelegate(tab_contents(),
registry,
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