| 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/search_engines/template_url_service.h" | 5 #include "chrome/browser/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/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/environment.h" | 13 #include "base/environment.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/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| 19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
| 21 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
| 22 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
| 26 #include "chrome/browser/google/google_url_tracker_factory.h" | 26 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 27 #include "chrome/browser/history/history_service.h" | 27 #include "chrome/browser/history/history_service.h" |
| 28 #include "chrome/browser/history/history_service_factory.h" | 28 #include "chrome/browser/history/history_service_factory.h" |
| 29 #include "chrome/browser/metrics/rappor/sampling.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/rlz/rlz.h" | 31 #include "chrome/browser/rlz/rlz.h" |
| 31 #include "chrome/browser/search_engines/search_host_to_urls_map.h" | 32 #include "chrome/browser/search_engines/search_host_to_urls_map.h" |
| 32 #include "chrome/browser/search_engines/search_terms_data.h" | 33 #include "chrome/browser/search_engines/search_terms_data.h" |
| 33 #include "chrome/browser/search_engines/template_url.h" | 34 #include "chrome/browser/search_engines/template_url.h" |
| 34 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 35 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 35 #include "chrome/browser/search_engines/template_url_service_observer.h" | 36 #include "chrome/browser/search_engines/template_url_service_observer.h" |
| 36 #include "chrome/browser/search_engines/util.h" | 37 #include "chrome/browser/search_engines/util.h" |
| 37 #include "chrome/browser/webdata/web_data_service.h" | 38 #include "chrome/browser/webdata/web_data_service.h" |
| 38 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 UpdateKeywordSearchTermsForURL(visits_to_add_[i]); | 959 UpdateKeywordSearchTermsForURL(visits_to_add_[i]); |
| 959 visits_to_add_.clear(); | 960 visits_to_add_.clear(); |
| 960 | 961 |
| 961 if (new_resource_keyword_version) | 962 if (new_resource_keyword_version) |
| 962 service_->SetBuiltinKeywordVersion(new_resource_keyword_version); | 963 service_->SetBuiltinKeywordVersion(new_resource_keyword_version); |
| 963 | 964 |
| 964 if (default_search_provider_) { | 965 if (default_search_provider_) { |
| 965 UMA_HISTOGRAM_ENUMERATION("Search.DefaultSearchProviderType", | 966 UMA_HISTOGRAM_ENUMERATION("Search.DefaultSearchProviderType", |
| 966 TemplateURLPrepopulateData::GetEngineType(*default_search_provider_), | 967 TemplateURLPrepopulateData::GetEngineType(*default_search_provider_), |
| 967 SEARCH_ENGINE_MAX); | 968 SEARCH_ENGINE_MAX); |
| 969 rappor::SampleDomainAndRegistryFromHost( |
| 970 "Search.DefaultSearchProvider", |
| 971 default_search_provider_->url_ref().GetHost()); |
| 968 } | 972 } |
| 969 } | 973 } |
| 970 | 974 |
| 971 base::string16 TemplateURLService::GetKeywordShortName( | 975 base::string16 TemplateURLService::GetKeywordShortName( |
| 972 const base::string16& keyword, | 976 const base::string16& keyword, |
| 973 bool* is_omnibox_api_extension_keyword) { | 977 bool* is_omnibox_api_extension_keyword) { |
| 974 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); | 978 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword); |
| 975 | 979 |
| 976 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService | 980 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLService |
| 977 // to track changes to the model, this should become a DCHECK. | 981 // to track changes to the model, this should become a DCHECK. |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2521 | 2525 |
| 2522 if (most_recently_intalled_default) { | 2526 if (most_recently_intalled_default) { |
| 2523 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2527 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
| 2524 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2528 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
| 2525 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2529 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
| 2526 most_recently_intalled_default->data()); | 2530 most_recently_intalled_default->data()); |
| 2527 } else { | 2531 } else { |
| 2528 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2532 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
| 2529 } | 2533 } |
| 2530 } | 2534 } |
| OLD | NEW |