OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | |
9 #include "chrome/browser/search_engines/template_url.h" | 8 #include "chrome/browser/search_engines/template_url.h" |
10 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 9 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
11 | 10 |
12 namespace protector { | 11 namespace protector { |
13 | 12 |
14 const char kProtectorHistogramDefaultSearchProvider[] = | 13 const char kProtectorHistogramDefaultSearchProvider[] = |
15 "Protector.DefaultSearchProvider"; | 14 "Protector.DefaultSearchProvider"; |
16 | 15 |
17 const char kProtectorHistogramSearchProviderApplied[] = | 16 const char kProtectorHistogramSearchProviderApplied[] = |
18 "Protector.SearchProvider.Applied"; | 17 "Protector.SearchProvider.Applied"; |
(...skipping 16 matching lines...) Expand all Loading... | |
35 "Protector.StartupSettings.Applied"; | 34 "Protector.StartupSettings.Applied"; |
36 const char kProtectorHistogramStartupSettingsChanged[] = | 35 const char kProtectorHistogramStartupSettingsChanged[] = |
37 "Protector.StartupSettings.Changed"; | 36 "Protector.StartupSettings.Changed"; |
38 const char kProtectorHistogramStartupSettingsDiscarded[] = | 37 const char kProtectorHistogramStartupSettingsDiscarded[] = |
39 "Protector.StartupSettings.Discarded"; | 38 "Protector.StartupSettings.Discarded"; |
40 const char kProtectorHistogramStartupSettingsTimeout[] = | 39 const char kProtectorHistogramStartupSettingsTimeout[] = |
41 "Protector.StartupSettings.Timeout"; | 40 "Protector.StartupSettings.Timeout"; |
42 | 41 |
43 const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX; | 42 const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX; |
44 | 43 |
45 int GetSearchProviderHistogramID(const TemplateURL* turl) { | 44 int GetSearchProviderHistogramID(const TemplateURL* t_url) { |
46 if (!turl || !turl->url()) | 45 return t_url ? |
sky
2012/03/14 21:18:05
You sure you don't need the && t_url->url() here t
Peter Kasting
2012/03/14 21:21:35
I do need it -- removing it is a change that will
| |
47 return SEARCH_ENGINE_NONE; | 46 TemplateURLPrepopulateData::GetEngineType(t_url->url()->url()) : |
48 scoped_ptr<TemplateURL> prepopulated_url( | 47 SEARCH_ENGINE_NONE; |
49 TemplateURLPrepopulateData::FindPrepopulatedEngine(turl->url()->url())); | |
50 if (prepopulated_url.get()) | |
51 return static_cast<int>(prepopulated_url->search_engine_type()); | |
52 // If |turl| is not among the prepopulated providers, return | |
53 // SEARCH_ENGINE_OTHER as well. | |
54 return SEARCH_ENGINE_OTHER; | |
55 } | 48 } |
56 | 49 |
57 } // namespace protector | 50 } // namespace protector |
OLD | NEW |