summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:50:55 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-11 12:50:55 +0000
commite1dcb27edc92f51c40193eb2c60b8e6046cbd6b6 (patch)
tree2c66988341f8a95bc91a8245b16da40539e215f3 /extensions
parentce7f33238c1ff053570735dc98644630710424b3 (diff)
downloadchromium_src-e1dcb27edc92f51c40193eb2c60b8e6046cbd6b6.zip
chromium_src-e1dcb27edc92f51c40193eb2c60b8e6046cbd6b6.tar.gz
chromium_src-e1dcb27edc92f51c40193eb2c60b8e6046cbd6b6.tar.bz2
Turn disallowed URL patterns such as <all_urls> for externally_connectable into
warnings not errors. This is for forward compatibility, if we ever lift the no-eTLD-wildcard restriction. Malformed URLs remain errors. BUG=55316 R=yoz@chromium.org Review URL: https://chromiumcodereview.appspot.com/16464004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions')
-rw-r--r--extensions/common/install_warning.h3
-rw-r--r--extensions/common/url_pattern_set.cc18
-rw-r--r--extensions/common/url_pattern_set.h6
3 files changed, 15 insertions, 12 deletions
diff --git a/extensions/common/install_warning.h b/extensions/common/install_warning.h
index 6a2cb65..fb3fccb 100644
--- a/extensions/common/install_warning.h
+++ b/extensions/common/install_warning.h
@@ -17,6 +17,9 @@ struct InstallWarning {
FORMAT_TEXT,
FORMAT_HTML,
};
+ static InstallWarning Text(const std::string& message) {
+ return InstallWarning(FORMAT_TEXT, message);
+ }
InstallWarning(Format format, const std::string& message)
: format(format), message(message) {
}
diff --git a/extensions/common/url_pattern_set.cc b/extensions/common/url_pattern_set.cc
index 7a19c71..0afe111 100644
--- a/extensions/common/url_pattern_set.cc
+++ b/extensions/common/url_pattern_set.cc
@@ -139,6 +139,15 @@ bool URLPatternSet::Contains(const URLPatternSet& other) const {
return true;
}
+bool URLPatternSet::ContainsPattern(const URLPattern& pattern) const {
+ for (URLPatternSet::const_iterator it = begin();
+ it != end(); ++it) {
+ if (it->Contains(pattern))
+ return true;
+ }
+ return false;
+}
+
bool URLPatternSet::MatchesURL(const GURL& url) const {
for (URLPatternSet::const_iterator pattern = patterns_.begin();
pattern != patterns_.end(); ++pattern) {
@@ -221,13 +230,4 @@ bool URLPatternSet::Populate(const base::ListValue& value,
return Populate(patterns, valid_schemes, allow_file_access, error);
}
-bool URLPatternSet::ContainsPattern(const URLPattern& pattern) const {
- for (URLPatternSet::const_iterator it = begin();
- it != end(); ++it) {
- if (it->Contains(pattern))
- return true;
- }
- return false;
-}
-
} // namespace extensions
diff --git a/extensions/common/url_pattern_set.h b/extensions/common/url_pattern_set.h
index 0481d30..da6ad13 100644
--- a/extensions/common/url_pattern_set.h
+++ b/extensions/common/url_pattern_set.h
@@ -72,6 +72,9 @@ class URLPatternSet {
// words, if every pattern in |set| is encompassed by a pattern in this.
bool Contains(const URLPatternSet& set) const;
+ // Returns true if any pattern in this set encompasses |pattern|.
+ bool ContainsPattern(const URLPattern& pattern) const;
+
// Test if the extent contains a URL.
bool MatchesURL(const GURL& url) const;
@@ -93,9 +96,6 @@ class URLPatternSet {
std::string* error);
private:
- // Returns true if any pattern in this set encompasses |pattern|.
- bool ContainsPattern(const URLPattern& pattern) const;
-
// The list of URL patterns that comprise the extent.
std::set<URLPattern> patterns_;
};