| 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
|
|
|