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

Unified Diff: chrome/common/content_settings_pattern_parser.cc

Issue 9133002: Added support for file URI path wildcards in content settings (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 8 years, 11 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/common/content_settings_pattern_parser.cc
===================================================================
--- chrome/common/content_settings_pattern_parser.cc (revision 118265)
+++ chrome/common/content_settings_pattern_parser.cc (working copy)
@@ -42,6 +42,8 @@
const char* PatternParser::kPortWildcard = "*";
+const char* PatternParser::kPathWildcard = "*";
+
// static
void PatternParser::Parse(const std::string& pattern_spec,
ContentSettingsPattern::BuilderInterface* builder) {
@@ -169,13 +171,18 @@
builder->WithPort(port);
}
} else {
- if (scheme != std::string(chrome::kExtensionScheme))
+ if (scheme != std::string(chrome::kExtensionScheme) &&
+ scheme != std::string(chrome::kFileScheme))
builder->WithPortWildcard();
}
if (path_component.IsNonEmpty()) {
- builder->WithPath(pattern_spec.substr(path_component.start,
- path_component.len));
+ const std::string path = pattern_spec.substr(path_component.start,
+ path_component.len);
+ if (path.substr(1) == kPathWildcard)
+ builder->WithPathWildcard();
+ else
+ builder->WithPath(path);
}
}
@@ -194,8 +201,12 @@
if (!parts.is_scheme_wildcard)
str += parts.scheme + chrome::kStandardSchemeSeparator;
- if (parts.scheme == std::string(chrome::kFileScheme))
- return str + parts.path;
+ if (parts.scheme == chrome::kFileScheme) {
+ if (parts.is_path_wildcard)
+ return str + kUrlPathSeparator + kPathWildcard;
+ else
+ return str + parts.path;
+ }
if (parts.has_domain_wildcard) {
if (parts.host.empty())
« no previous file with comments | « chrome/common/content_settings_pattern_parser.h ('k') | chrome/common/content_settings_pattern_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698