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

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

Issue 2446273004: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Review comment Created 4 years, 1 month 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"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_url_provider.cc ('k') | components/ssl_errors/error_classification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698