Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: components/search_engines/template_url_service.cc

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Fix more compile errors in JNI files Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/template_url_service.h" 5 #include "components/search_engines/template_url_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/guid.h" 14 #include "base/guid.h"
15 #include "base/i18n/case_conversion.h" 15 #include "base/i18n/case_conversion.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
18 #include "base/profiler/scoped_tracker.h" 18 #include "base/profiler/scoped_tracker.h"
19 #include "base/strings/string_split.h" 19 #include "base/strings/string_split.h"
20 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/time/default_clock.h" 22 #include "base/time/default_clock.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "components/omnibox/browser/omnibox_field_trial.h" 24 #include "components/omnibox/browser/omnibox_field_trial.h"
25 #include "components/pref_registry/pref_registry_syncable.h" 25 #include "components/pref_registry/pref_registry_syncable.h"
26 #include "components/prefs/pref_service.h" 26 #include "components/prefs/pref_service.h"
27 #include "components/rappor/rappor_service.h" 27 #include "components/rappor/rappor_service_impl.h"
28 #include "components/search_engines/search_engines_pref_names.h" 28 #include "components/search_engines/search_engines_pref_names.h"
29 #include "components/search_engines/search_host_to_urls_map.h" 29 #include "components/search_engines/search_host_to_urls_map.h"
30 #include "components/search_engines/search_terms_data.h" 30 #include "components/search_engines/search_terms_data.h"
31 #include "components/search_engines/template_url.h" 31 #include "components/search_engines/template_url.h"
32 #include "components/search_engines/template_url_prepopulate_data.h" 32 #include "components/search_engines/template_url_prepopulate_data.h"
33 #include "components/search_engines/template_url_service_client.h" 33 #include "components/search_engines/template_url_service_client.h"
34 #include "components/search_engines/template_url_service_observer.h" 34 #include "components/search_engines/template_url_service_observer.h"
35 #include "components/search_engines/util.h" 35 #include "components/search_engines/util.h"
36 #include "components/sync/model/sync_change.h" 36 #include "components/sync/model/sync_change.h"
37 #include "components/sync/model/sync_error_factory.h" 37 #include "components/sync/model/sync_error_factory.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 223
224 224
225 // TemplateURLService --------------------------------------------------------- 225 // TemplateURLService ---------------------------------------------------------
226 226
227 TemplateURLService::TemplateURLService( 227 TemplateURLService::TemplateURLService(
228 PrefService* prefs, 228 PrefService* prefs,
229 std::unique_ptr<SearchTermsData> search_terms_data, 229 std::unique_ptr<SearchTermsData> search_terms_data,
230 const scoped_refptr<KeywordWebDataService>& web_data_service, 230 const scoped_refptr<KeywordWebDataService>& web_data_service,
231 std::unique_ptr<TemplateURLServiceClient> client, 231 std::unique_ptr<TemplateURLServiceClient> client,
232 GoogleURLTracker* google_url_tracker, 232 GoogleURLTracker* google_url_tracker,
233 rappor::RapporService* rappor_service, 233 rappor::RapporServiceImpl* rappor_service,
234 const base::Closure& dsp_change_callback) 234 const base::Closure& dsp_change_callback)
235 : prefs_(prefs), 235 : prefs_(prefs),
236 search_terms_data_(std::move(search_terms_data)), 236 search_terms_data_(std::move(search_terms_data)),
237 web_data_service_(web_data_service), 237 web_data_service_(web_data_service),
238 client_(std::move(client)), 238 client_(std::move(client)),
239 google_url_tracker_(google_url_tracker), 239 google_url_tracker_(google_url_tracker),
240 rappor_service_(rappor_service), 240 rappor_service_(rappor_service),
241 dsp_change_callback_(dsp_change_callback), 241 dsp_change_callback_(dsp_change_callback),
242 provider_map_(new SearchHostToURLsMap), 242 provider_map_(new SearchHostToURLsMap),
243 loaded_(false), 243 loaded_(false),
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 tracked_objects::ScopedTracker tracking_profile5( 863 tracked_objects::ScopedTracker tracking_profile5(
864 FROM_HERE_WITH_EXPLICIT_FUNCTION( 864 FROM_HERE_WITH_EXPLICIT_FUNCTION(
865 "422460 TemplateURLService::OnWebDataServiceRequestDone 5")); 865 "422460 TemplateURLService::OnWebDataServiceRequestDone 5"));
866 866
867 UMA_HISTOGRAM_ENUMERATION( 867 UMA_HISTOGRAM_ENUMERATION(
868 "Search.DefaultSearchProviderType", 868 "Search.DefaultSearchProviderType",
869 default_search_provider_->GetEngineType(search_terms_data()), 869 default_search_provider_->GetEngineType(search_terms_data()),
870 SEARCH_ENGINE_MAX); 870 SEARCH_ENGINE_MAX);
871 871
872 if (rappor_service_) { 872 if (rappor_service_) {
873 rappor_service_->RecordSample( 873 rappor_service_->RecordSampleString(
874 "Search.DefaultSearchProvider", 874 "Search.DefaultSearchProvider", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
875 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
876 net::registry_controlled_domains::GetDomainAndRegistry( 875 net::registry_controlled_domains::GetDomainAndRegistry(
877 default_search_provider_->url_ref().GetHost(search_terms_data()), 876 default_search_provider_->url_ref().GetHost(search_terms_data()),
878 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); 877 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
879 } 878 }
880 } 879 }
881 } 880 }
882 881
883 base::string16 TemplateURLService::GetKeywordShortName( 882 base::string16 TemplateURLService::GetKeywordShortName(
884 const base::string16& keyword, 883 const base::string16& keyword,
885 bool* is_omnibox_api_extension_keyword) { 884 bool* is_omnibox_api_extension_keyword) {
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 2496
2498 if (most_recently_intalled_default) { 2497 if (most_recently_intalled_default) {
2499 base::AutoReset<DefaultSearchChangeOrigin> change_origin( 2498 base::AutoReset<DefaultSearchChangeOrigin> change_origin(
2500 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); 2499 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION);
2501 default_search_manager_.SetExtensionControlledDefaultSearchEngine( 2500 default_search_manager_.SetExtensionControlledDefaultSearchEngine(
2502 most_recently_intalled_default->data()); 2501 most_recently_intalled_default->data());
2503 } else { 2502 } else {
2504 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); 2503 default_search_manager_.ClearExtensionControlledDefaultSearchEngine();
2505 } 2504 }
2506 } 2505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698