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

Unified Diff: chrome/browser/supervised_user/supervised_user_url_filter.cc

Issue 2456643005: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Fix Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/supervised_user_url_filter.cc
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc
index f32da08ea3486bcf2f546b9ca965cdab1f5ca97d..0fd9c7db713c657689335ca0433e3e3e436f7067 100644
--- a/chrome/browser/supervised_user/supervised_user_url_filter.cc
+++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc
@@ -39,7 +39,7 @@
using content::BrowserThread;
using net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES;
using net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES;
-using net::registry_controlled_domains::GetRegistryLength;
+using net::registry_controlled_domains::GetCanonicalHostRegistryLength;
using policy::URLBlacklist;
using url_matcher::URLMatcher;
using url_matcher::URLMatcherConditionSet;
@@ -280,12 +280,13 @@ bool SupervisedUserURLFilter::HasFilteredScheme(const GURL& url) {
}
// static
-bool SupervisedUserURLFilter::HostMatchesPattern(const std::string& host,
- const std::string& pattern) {
+bool SupervisedUserURLFilter::HostMatchesPattern(
+ const std::string& canonical_host,
+ const std::string& pattern) {
std::string trimmed_pattern = pattern;
- std::string trimmed_host = host;
+ std::string trimmed_host = canonical_host;
if (base::EndsWith(pattern, ".*", base::CompareCase::SENSITIVE)) {
- size_t registry_length = GetRegistryLength(
+ size_t registry_length = GetCanonicalHostRegistryLength(
trimmed_host, EXCLUDE_UNKNOWN_REGISTRIES, EXCLUDE_PRIVATE_REGISTRIES);
// A host without a known registry part does not match.
if (registry_length == 0)

Powered by Google App Engine
This is Rietveld 408576698