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

Unified Diff: extensions/common/url_pattern.h

Issue 12792005: Allow extensions on chrome:// URLs, when flag is set and permission is explicitly requested (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More cleanup Created 7 years, 9 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
« no previous file with comments | « chrome/common/extensions/user_script.cc ('k') | extensions/common/url_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/url_pattern.h
diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h
index a6dfa7480af2e2514060623c5b79968cd5b0f661..3775f0b0090e661551c027d49761e24b6ad914d5 100644
--- a/extensions/common/url_pattern.h
+++ b/extensions/common/url_pattern.h
@@ -100,6 +100,9 @@ class URLPattern {
int valid_schemes() const { return valid_schemes_; }
void SetValidSchemes(int valid_schemes);
+ int allowed_schemes() const { return allowed_schemes_; }
+ void SetAllowedSchemes(int allowed_schemes);
+
// Gets the host the pattern matches. This can be an empty string if the
// pattern matches all hosts (the input was <scheme>://*/<whatever>).
const std::string& host() const { return host_; }
@@ -130,6 +133,10 @@ class URLPattern {
// false otherwise. Uses valid_schemes_ to determine validity.
bool IsValidScheme(const std::string& scheme) const;
+ // Returns true if the specified scheme is allowed by this URL pattern, and
+ // false otherwise. Uses allowed_schemes_ to determine status.
+ bool IsAllowedScheme(const std::string& scheme) const;
+
// Returns true if this instance matches the specified URL.
bool MatchesURL(const GURL& test) const;
@@ -188,6 +195,9 @@ class URLPattern {
// Get an error string for a ParseResult.
static const char* GetParseResultString(URLPattern::ParseResult parse_result);
+ // Checks whether the bit is set for the given scheme in the given scheme mask
+ static bool IsSchemeBitSet(const std::string& scheme, const int mask);
+
private:
// Returns true if any of the |schemes| items matches our scheme.
bool MatchesAnyScheme(const std::vector<std::string>& schemes) const;
@@ -206,10 +216,14 @@ class URLPattern {
// A bitmask containing the schemes which are considered valid for this
// pattern. Parse() uses this to decide whether a pattern contains a valid
- // scheme. MatchesScheme uses this to decide whether a wildcard scheme_
- // matches a given test scheme.
+ // scheme.
int valid_schemes_;
+ // A bitmask containing the schemes which return a positive match for this
+ // pattern. MatchesScheme uses this to decide whether a wildcard scheme_
+ // matches a given test scheme.
+ int allowed_schemes_;
+
// True if this is a special-case "<all_urls>" pattern.
bool match_all_urls_;
« no previous file with comments | « chrome/common/extensions/user_script.cc ('k') | extensions/common/url_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698