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

Unified Diff: chrome/browser/protector/histograms.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/histograms.h ('k') | chrome/browser/protector/protector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/histograms.cc
diff --git a/chrome/browser/protector/histograms.cc b/chrome/browser/protector/histograms.cc
index d18d0276e8c1309dfa0ab75fcb0a83394519fdda..7166d9cbc8f665b990ac99f847ab2935497d1950 100644
--- a/chrome/browser/protector/histograms.cc
+++ b/chrome/browser/protector/histograms.cc
@@ -4,6 +4,11 @@
#include "chrome/browser/protector/histograms.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/search_engines/search_engine_type.h"
+#include "chrome/browser/search_engines/template_url.h"
+#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
+
namespace protector {
const char kProtectorHistogramDefaultSearchProvider[] =
@@ -14,4 +19,28 @@ const char kProtectorBackupInvalidCounter[] =
const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter";
const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter";
+const char kProtectorHistogramNewSearchProvider[] =
+ "Protector.NewSearchProvider";
+const char kProtectorHistogramSearchProviderApplied[] =
+ "Protector.SearchProviderApplied";
+const char kProtectorHistogramSearchProviderDiscarded[] =
+ "Protector.SearchProviderDiscarded";
+const char kProtectorHistogramSearchProviderTimeout[] =
+ "Protector.SearchProviderTimeout";
+
+const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX;
+
+int GetSearchProviderHistogramID(const TemplateURL* t_url) {
+ if (t_url && t_url->url()) {
+ scoped_ptr<TemplateURL> prepopulated_url(
+ TemplateURLPrepopulateData::FindPrepopulatedEngine(
+ t_url->url()->url()));
+ if (prepopulated_url.get())
+ return static_cast<int>(prepopulated_url->search_engine_type());
+ }
+ // If |t_url| is NULL or not among the prepopulated providers, return
+ // SEARCH_ENGINE_OTHER as well.
+ return SEARCH_ENGINE_OTHER;
+}
+
} // namespace protector
« no previous file with comments | « chrome/browser/protector/histograms.h ('k') | chrome/browser/protector/protector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698