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 "chrome/browser/search_engines/search_engine_type.h" | |
8 #include "chrome/browser/search_engines/template_url.h" | |
9 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | |
10 | |
7 namespace protector { | 11 namespace protector { |
8 | 12 |
9 const char kProtectorHistogramDefaultSearchProvider[] = | 13 const char kProtectorHistogramDefaultSearchProvider[] = |
10 "Protector.DefaultSearchProvider"; | 14 "Protector.DefaultSearchProvider"; |
11 | 15 |
12 const char kProtectorBackupInvalidCounter[] = | 16 const char kProtectorBackupInvalidCounter[] = |
13 "Protector.BackupInvalidCounter"; | 17 "Protector.BackupInvalidCounter"; |
14 const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter"; | 18 const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter"; |
15 const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter"; | 19 const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter"; |
16 | 20 |
21 const char kProtectorHistogramNewSearchProvider[] = | |
22 "Protector.NewSearchProvider"; | |
23 const char kProtectorHistogramSearchProviderApplied[] = | |
24 "Protector.SearchProviderApplied"; | |
25 const char kProtectorHistogramSearchProviderDiscarded[] = | |
26 "Protector.SearchProviderDiscarded"; | |
27 const char kProtectorHistogramSearchProviderTimeout[] = | |
28 "Protector.SearchProviderTimeout"; | |
29 | |
30 const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX; | |
31 | |
32 int GetSearchProviderHistogramID(const TemplateURL* t_url) { | |
33 if (t_url && t_url->url()) { | |
34 TemplateURL* prepopulated = | |
whywhat
2011/11/21 17:14:57
We need to delete it.
Ivan Korotkov
2011/11/21 17:39:22
Oops.
| |
35 TemplateURLPrepopulateData::FindPrepopulatedEngine(t_url->url()->url()); | |
36 if (prepopulated) | |
37 return static_cast<int>(prepopulated->search_engine_type()); | |
38 } | |
39 // If |t_url| is NULL or not among the prepopulated providers, return | |
40 // SEARCH_ENGINE_OTHER as well. | |
41 return SEARCH_ENGINE_OTHER; | |
42 } | |
43 | |
17 } // namespace protector | 44 } // namespace protector |
OLD | NEW |