OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/protector/histograms.h" | 5 #include "chrome/browser/protector/histograms.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/search_engines/search_engine_type.h" | 8 #include "chrome/browser/search_engines/search_engine_type.h" |
9 #include "chrome/browser/search_engines/template_url.h" | 9 #include "chrome/browser/search_engines/template_url.h" |
10 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 10 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
11 | 11 |
12 namespace protector { | 12 namespace protector { |
13 | 13 |
14 const char kProtectorHistogramDefaultSearchProvider[] = | 14 const char kProtectorHistogramDefaultSearchProvider[] = |
15 "Protector.DefaultSearchProvider"; | 15 "Protector.DefaultSearchProvider"; |
16 | 16 |
17 const char kProtectorBackupInvalidCounter[] = | 17 const char kProtectorBackupInvalidCounter[] = |
18 "Protector.BackupInvalidCounter"; | 18 "Protector.BackupInvalidCounter"; |
19 const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter"; | 19 const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter"; |
20 const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter"; | 20 const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter"; |
21 | 21 |
22 const char kProtectorHistogramNewSearchProvider[] = | 22 const char kProtectorHistogramNewSearchProvider[] = |
23 "Protector.SearchProvider.New"; | 23 "Protector.SearchProvider.New"; |
24 const char kProtectorHistogramSearchProviderApplied[] = | 24 const char kProtectorHistogramSearchProviderApplied[] = |
25 "Protector.SearchProvider.Applied"; | 25 "Protector.SearchProvider.Applied"; |
26 const char kProtectorHistogramSearchProviderDiscarded[] = | 26 const char kProtectorHistogramSearchProviderDiscarded[] = |
27 "Protector.SearchProvider.Discarded"; | 27 "Protector.SearchProvider.Discarded"; |
| 28 const char kProtectorHistogramSearchProviderFallback[] = |
| 29 "Protector.SearchProvider.Fallback"; |
| 30 const char kProtectorHistogramSearchProviderMissing[] = |
| 31 "Protector.SearchProvider.Missing"; |
| 32 const char kProtectorHistogramSearchProviderRestored[] = |
| 33 "Protector.SearchProvider.Restored"; |
28 const char kProtectorHistogramSearchProviderTimeout[] = | 34 const char kProtectorHistogramSearchProviderTimeout[] = |
29 "Protector.SearchProvider.Timeout"; | 35 "Protector.SearchProvider.Timeout"; |
30 | 36 |
31 const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX; | 37 const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX; |
32 | 38 |
33 int GetSearchProviderHistogramID(const TemplateURL* t_url) { | 39 int GetSearchProviderHistogramID(const TemplateURL* t_url) { |
34 if (t_url && t_url->url()) { | 40 if (t_url && t_url->url()) { |
35 scoped_ptr<TemplateURL> prepopulated_url( | 41 scoped_ptr<TemplateURL> prepopulated_url( |
36 TemplateURLPrepopulateData::FindPrepopulatedEngine( | 42 TemplateURLPrepopulateData::FindPrepopulatedEngine( |
37 t_url->url()->url())); | 43 t_url->url()->url())); |
38 if (prepopulated_url.get()) | 44 if (prepopulated_url.get()) |
39 return static_cast<int>(prepopulated_url->search_engine_type()); | 45 return static_cast<int>(prepopulated_url->search_engine_type()); |
40 } | 46 } |
41 // If |t_url| is NULL or not among the prepopulated providers, return | 47 // If |t_url| is NULL or not among the prepopulated providers, return |
42 // SEARCH_ENGINE_OTHER as well. | 48 // SEARCH_ENGINE_OTHER as well. |
43 return SEARCH_ENGINE_OTHER; | 49 return SEARCH_ENGINE_OTHER; |
44 } | 50 } |
45 | 51 |
46 } // namespace protector | 52 } // namespace protector |
OLD | NEW |