OLD | NEW |
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" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (it->second > 1) | 146 if (it->second > 1) |
147 num_dupes++; | 147 num_dupes++; |
148 } | 148 } |
149 | 149 |
150 UMA_HISTOGRAM_COUNTS_100("Search.SearchEngineDuplicateCounts", num_dupes); | 150 UMA_HISTOGRAM_COUNTS_100("Search.SearchEngineDuplicateCounts", num_dupes); |
151 } | 151 } |
152 | 152 |
153 // Returns the length of the registry portion of a hostname. For example, | 153 // Returns the length of the registry portion of a hostname. For example, |
154 // www.google.co.uk will return 5 (the length of co.uk). | 154 // www.google.co.uk will return 5 (the length of co.uk). |
155 size_t GetRegistryLength(const base::string16& host) { | 155 size_t GetRegistryLength(const base::string16& host) { |
156 return net::registry_controlled_domains::GetRegistryLength( | 156 return net::registry_controlled_domains::PermissiveGetHostRegistryLength( |
157 base::UTF16ToUTF8(host), | 157 host, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
158 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | |
159 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 158 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
160 } | 159 } |
161 | 160 |
162 // Returns the domain name (including registry) of a hostname. For example, | 161 // Returns the domain name (including registry) of a hostname. For example, |
163 // www.google.co.uk will return google.co.uk. | 162 // www.google.co.uk will return google.co.uk. |
164 base::string16 GetDomainAndRegistry(const base::string16& host) { | 163 base::string16 GetDomainAndRegistry(const base::string16& host) { |
165 return base::UTF8ToUTF16( | 164 return base::UTF8ToUTF16( |
166 net::registry_controlled_domains::GetDomainAndRegistry( | 165 net::registry_controlled_domains::GetDomainAndRegistry( |
167 base::UTF16ToUTF8(host), | 166 base::UTF16ToUTF8(host), |
168 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)); | 167 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)); |
(...skipping 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2474 | 2473 |
2475 if (most_recently_intalled_default) { | 2474 if (most_recently_intalled_default) { |
2476 base::AutoReset<DefaultSearchChangeOrigin> change_origin( | 2475 base::AutoReset<DefaultSearchChangeOrigin> change_origin( |
2477 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); | 2476 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); |
2478 default_search_manager_.SetExtensionControlledDefaultSearchEngine( | 2477 default_search_manager_.SetExtensionControlledDefaultSearchEngine( |
2479 most_recently_intalled_default->data()); | 2478 most_recently_intalled_default->data()); |
2480 } else { | 2479 } else { |
2481 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); | 2480 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); |
2482 } | 2481 } |
2483 } | 2482 } |
OLD | NEW |