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

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

Issue 2510803003: Pass RapporService to content/browser/ (Closed)
Patch Set: Applying comments 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 tracked_objects::ScopedTracker tracking_profile5( 852 tracked_objects::ScopedTracker tracking_profile5(
853 FROM_HERE_WITH_EXPLICIT_FUNCTION( 853 FROM_HERE_WITH_EXPLICIT_FUNCTION(
854 "422460 TemplateURLService::OnWebDataServiceRequestDone 5")); 854 "422460 TemplateURLService::OnWebDataServiceRequestDone 5"));
855 855
856 UMA_HISTOGRAM_ENUMERATION( 856 UMA_HISTOGRAM_ENUMERATION(
857 "Search.DefaultSearchProviderType", 857 "Search.DefaultSearchProviderType",
858 default_search_provider_->GetEngineType(search_terms_data()), 858 default_search_provider_->GetEngineType(search_terms_data()),
859 SEARCH_ENGINE_MAX); 859 SEARCH_ENGINE_MAX);
860 860
861 if (rappor_service_) { 861 if (rappor_service_) {
862 rappor_service_->RecordSample( 862 rappor_service_->RecordSampleString(
863 "Search.DefaultSearchProvider", 863 "Search.DefaultSearchProvider", rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
864 rappor::ETLD_PLUS_ONE_RAPPOR_TYPE,
865 net::registry_controlled_domains::GetDomainAndRegistry( 864 net::registry_controlled_domains::GetDomainAndRegistry(
866 default_search_provider_->url_ref().GetHost(search_terms_data()), 865 default_search_provider_->url_ref().GetHost(search_terms_data()),
867 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES)); 866 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES));
868 } 867 }
869 } 868 }
870 } 869 }
871 870
872 base::string16 TemplateURLService::GetKeywordShortName( 871 base::string16 TemplateURLService::GetKeywordShortName(
873 const base::string16& keyword, 872 const base::string16& keyword,
874 bool* is_omnibox_api_extension_keyword) { 873 bool* is_omnibox_api_extension_keyword) {
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 2474
2476 if (most_recently_intalled_default) { 2475 if (most_recently_intalled_default) {
2477 base::AutoReset<DefaultSearchChangeOrigin> change_origin( 2476 base::AutoReset<DefaultSearchChangeOrigin> change_origin(
2478 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); 2477 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION);
2479 default_search_manager_.SetExtensionControlledDefaultSearchEngine( 2478 default_search_manager_.SetExtensionControlledDefaultSearchEngine(
2480 most_recently_intalled_default->data()); 2479 most_recently_intalled_default->data());
2481 } else { 2480 } else {
2482 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); 2481 default_search_manager_.ClearExtensionControlledDefaultSearchEngine();
2483 } 2482 }
2484 } 2483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698