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

Unified Diff: chrome/browser/protector/default_search_provider_change.cc

Issue 8575018: Protector histograms for default search provider change added. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/protector/base_setting_change.cc ('k') | chrome/browser/protector/histograms.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/default_search_provider_change.cc
diff --git a/chrome/browser/protector/default_search_provider_change.cc b/chrome/browser/protector/default_search_provider_change.cc
index 026788d49e8f2ec4cbb6cf4011eeec63b871ee54..296ebee358b0ed2f86a504987bbabe36ae6dc892 100644
--- a/chrome/browser/protector/default_search_provider_change.cc
+++ b/chrome/browser/protector/default_search_provider_change.cc
@@ -5,16 +5,18 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "chrome/browser/protector/base_setting_change.h"
+#include "chrome/browser/protector/histograms.h"
#include "chrome/browser/protector/protector.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_observer.h"
#include "chrome/browser/webdata/keyword_table.h"
#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
-#include "googleurl/src/gurl.h"
#include "ui/base/l10n/l10n_util.h"
namespace protector {
@@ -36,6 +38,7 @@ class DefaultSearchProviderChange : public BaseSettingChange,
virtual bool Init(Protector* protector) OVERRIDE;
virtual void Apply() OVERRIDE;
virtual void Discard() OVERRIDE;
+ virtual void Timeout() OVERRIDE;
virtual void OnBeforeRemoved() OVERRIDE;
virtual string16 GetBubbleTitle() const OVERRIDE;
virtual string16 GetBubbleMessage() const OVERRIDE;
@@ -67,6 +70,8 @@ class DefaultSearchProviderChange : public BaseSettingChange,
// Name of the search engine that we fall back to if the backup is lost.
string16 fallback_name_;
string16 product_name_;
+ // Histogram ID of the new search provider.
+ int new_histogram_id_;
// Default search provider set by |Init| for the period until user makes a
// choice and either |Apply| or |Discard| is performed. Should only be used
// for comparison with the current default search provider and never
@@ -84,6 +89,7 @@ DefaultSearchProviderChange::DefaultSearchProviderChange(
new_id_(0),
fallback_id_(0),
product_name_(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)),
+ new_histogram_id_(GetSearchProviderHistogramID(new_url)),
default_search_provider_(NULL) {
if (new_url) {
new_id_ = new_url->id();
@@ -101,6 +107,11 @@ DefaultSearchProviderChange::~DefaultSearchProviderChange() {
bool DefaultSearchProviderChange::Init(Protector* protector) {
BaseSettingChange::Init(protector);
+ UMA_HISTOGRAM_ENUMERATION(
+ kProtectorHistogramNewSearchProvider,
+ new_histogram_id_,
+ kProtectorMaxSearchProviderID);
+
// Initially reset the search engine to its previous setting.
default_search_provider_ = SetDefaultSearchProvider(old_id_, true);
if (!default_search_provider_)
@@ -120,7 +131,11 @@ bool DefaultSearchProviderChange::Init(Protector* protector) {
}
void DefaultSearchProviderChange::Apply() {
- // TODO(avayvod): Add histrogram.
+ UMA_HISTOGRAM_ENUMERATION(
+ kProtectorHistogramSearchProviderApplied,
+ new_histogram_id_,
+ kProtectorMaxSearchProviderID);
+
if (!new_id_) {
// Open settings page in case the new setting is invalid.
OpenSearchEngineSettings();
@@ -130,7 +145,11 @@ void DefaultSearchProviderChange::Apply() {
}
void DefaultSearchProviderChange::Discard() {
- // TODO(avayvod): Add histrogram.
+ UMA_HISTOGRAM_ENUMERATION(
+ kProtectorHistogramSearchProviderDiscarded,
+ new_histogram_id_,
+ kProtectorMaxSearchProviderID);
+
if (!old_id_) {
// Open settings page in case the old setting is invalid.
OpenSearchEngineSettings();
@@ -139,6 +158,13 @@ void DefaultSearchProviderChange::Discard() {
// to |old_id_| in |Init|.
}
+void DefaultSearchProviderChange::Timeout() {
+ UMA_HISTOGRAM_ENUMERATION(
+ kProtectorHistogramSearchProviderTimeout,
+ new_histogram_id_,
+ kProtectorMaxSearchProviderID);
+}
+
void DefaultSearchProviderChange::OnBeforeRemoved() {
protector()->GetTemplateURLService()->RemoveObserver(this);
}
« no previous file with comments | « chrome/browser/protector/base_setting_change.cc ('k') | chrome/browser/protector/histograms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698