Chromium Code Reviews| Index: chrome/browser/protector/histograms.cc |
| diff --git a/chrome/browser/protector/histograms.cc b/chrome/browser/protector/histograms.cc |
| index d18d0276e8c1309dfa0ab75fcb0a83394519fdda..1f5182dae4a30fee1f5aa62d447a616324db627b 100644 |
| --- a/chrome/browser/protector/histograms.cc |
| +++ b/chrome/browser/protector/histograms.cc |
| @@ -4,6 +4,10 @@ |
| #include "chrome/browser/protector/histograms.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 +18,27 @@ 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()) { |
| + TemplateURL* prepopulated = |
|
whywhat
2011/11/21 17:14:57
We need to delete it.
Ivan Korotkov
2011/11/21 17:39:22
Oops.
|
| + TemplateURLPrepopulateData::FindPrepopulatedEngine(t_url->url()->url()); |
| + if (prepopulated) |
| + return static_cast<int>(prepopulated->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 |