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

Unified Diff: chrome/common/extensions/url_pattern.h

Issue 8885022: Move URLPattern::ParseOption into a field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor sprucing Created 9 years 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/extension_messages.cc ('k') | chrome/common/extensions/url_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/url_pattern.h
diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h
index b9d039d9d3a4638b9b3206e640e93e752edf8b94..ef01c1b6ee8db2ef105cc525325b8306edc98deb 100644
--- a/chrome/common/extensions/url_pattern.h
+++ b/chrome/common/extensions/url_pattern.h
@@ -123,17 +123,13 @@ class URLPattern {
// The <all_urls> string pattern.
static const char kAllUrlsPattern[];
- // Construct an URLPattern with the given set of allowable schemes. See
- // valid_schemes_ for more info.
- explicit URLPattern(int valid_schemes);
+ explicit URLPattern(ParseOption parse_option, int valid_schemes);
// Convenience to construct a URLPattern from a string. The string is expected
- // to be a valid pattern. If the string is not known ahead of time, use
- // Parse() instead, which returns success or failure.
+ // to be a valid pattern when parsed with USE_PORTS. If the string is not
+ // known ahead of time, use Parse() instead, which returns success or failure.
URLPattern(int valid_schemes, const std::string& pattern);
- // Note: don't use this directly. This exists so URLPattern can be used
- // with STL containers.
URLPattern();
~URLPattern();
@@ -143,21 +139,17 @@ class URLPattern {
// Initializes this instance by parsing the provided string. Returns
// URLPattern::PARSE_SUCCESS on success, or an error code otherwise. On
// failure, this instance will have some intermediate values and is in an
- // invalid state. Adding error checks to URLPattern::Parse() can cause
- // patterns in installed extensions to fail. If an installed extension
- // uses a pattern that was valid but fails a new error check, the
- // extension will fail to load when chrome is auto-updated. To avoid
- // this, new parse checks are enabled only when |strictness| is
- // OPTION_STRICT. OPTION_STRICT should be used when loading in developer
- // mode, or when an extension's patterns are controlled by chrome (such
- // as component extensions).
- ParseResult Parse(const std::string& pattern_str,
- ParseOption strictness);
+ // invalid state.
+ ParseResult Parse(const std::string& pattern_str);
// Gets the bitmask of valid schemes.
int valid_schemes() const { return valid_schemes_; }
void SetValidSchemes(int valid_schemes);
+ // Gets or sets the parse option used with Parse().
+ ParseOption parse_option() const { return parse_option_; }
+ void SetParseOption(ParseOption parse_option);
+
// 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_; }
@@ -252,6 +244,9 @@ class URLPattern {
// equivalent literal schemes, otherwise returns the current scheme.
std::vector<std::string> GetExplicitSchemes() const;
+ // Controls how to interpret the input to Parse().
+ ParseOption parse_option_;
+
// 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_
« no previous file with comments | « chrome/common/extensions/extension_messages.cc ('k') | chrome/common/extensions/url_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698