Index: components/policy/core/browser/url_blacklist_manager.cc |
diff --git a/components/policy/core/browser/url_blacklist_manager.cc b/components/policy/core/browser/url_blacklist_manager.cc |
index e0f93b7d9ca9d89b72c2497423d5d247948dbe1f..c2ed412bb89fc7aaba2e4f65b9c7108ba8799c8c 100644 |
--- a/components/policy/core/browser/url_blacklist_manager.cc |
+++ b/components/policy/core/browser/url_blacklist_manager.cc |
@@ -262,6 +262,19 @@ bool URLBlacklist::FilterToComponents(const std::string& filter, |
const std::string lc_filter = base::ToLowerASCII(filter); |
const std::string url_scheme = url_formatter::SegmentURL(filter, &parsed); |
+ // Check if it's a scheme wildcard pattern. We support both versions |
+ // (scheme:* and scheme://*) the later being consistent with old filter |
+ // definitions. |
+ if (lc_filter == url_scheme + ":*" || lc_filter == url_scheme + "://*") { |
+ scheme->assign(url_scheme); |
+ host->clear(); |
+ *match_subdomains = true; |
+ *port = 0; |
+ path->clear(); |
+ query->clear(); |
+ return true; |
+ } |
+ |
if (url_scheme == url::kFileScheme) { |
base::FilePath file_path; |
if (!net::FileURLToFilePath(GURL(filter), &file_path)) |
@@ -271,11 +284,7 @@ bool URLBlacklist::FilterToComponents(const std::string& filter, |
host->clear(); |
*match_subdomains = true; |
*port = 0; |
- // Special path when the |filter| is 'file://*' or 'file:*'. |
- if (lc_filter == "file:*" || lc_filter == "file://*") |
- path->clear(); |
- else |
- *path = file_path.AsUTF8Unsafe(); |
+ *path = file_path.AsUTF8Unsafe(); |
#if defined(FILE_PATH_USES_WIN_SEPARATORS) |
// Separators have to be canonicalized on Windows. |
std::replace(path->begin(), path->end(), '\\', '/'); |
@@ -284,19 +293,6 @@ bool URLBlacklist::FilterToComponents(const std::string& filter, |
return true; |
} |
- // Check if it's a scheme wildcard pattern. We support both versions |
- // (scheme:* and scheme://*) the later being consistent with old filter |
- // definitions. |
- if (lc_filter == url_scheme + ":*" || lc_filter == url_scheme + "://*") { |
- scheme->assign(url_scheme); |
- host->clear(); |
- *match_subdomains = true; |
- *port = 0; |
- path->clear(); |
- query->clear(); |
- return true; |
- } |
- |
// According to documentation host can't be empty. |
if (!parsed.host.is_nonempty()) |
return false; |