| Index: chrome/common/extensions/url_pattern.h
|
| diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h
|
| index 113d266110d43b73715fc8252705e1bbd9a59ea4..c357b2d281f618d35f00f7ffaca00de9db0ead78 100644
|
| --- a/chrome/common/extensions/url_pattern.h
|
| +++ b/chrome/common/extensions/url_pattern.h
|
| @@ -132,28 +132,40 @@ class URLPattern {
|
| // Parse() instead, which returns success or failure.
|
| URLPattern(int valid_schemes, const std::string& pattern);
|
|
|
| -#if defined(_MSC_VER) && _MSC_VER >= 1600
|
| // Note: don't use this directly. This exists so URLPattern can be used
|
| - // with STL containers. Starting with Visual Studio 2010, we can't have this
|
| - // method private and use "friend class std::vector<URLPattern>;" as we used
|
| - // to do.
|
| + // with STL containers.
|
| URLPattern();
|
| -#endif
|
| -
|
| ~URLPattern();
|
|
|
| + bool operator<(const URLPattern& other) const;
|
| + bool operator==(const URLPattern& other) const;
|
| +
|
| + // 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);
|
| +
|
| // Gets the bitmask of valid schemes.
|
| int valid_schemes() const { return valid_schemes_; }
|
| - void set_valid_schemes(int valid_schemes) { valid_schemes_ = valid_schemes; }
|
| + void SetValidSchemes(int valid_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_; }
|
| - void set_host(const std::string& host) { host_ = host; }
|
| + void SetHost(const std::string& host);
|
|
|
| // Gets whether to match subdomains of host().
|
| bool match_subdomains() const { return match_subdomains_; }
|
| - void set_match_subdomains(bool val) { match_subdomains_ = val; }
|
| + void SetMatchSubdomains(bool val);
|
|
|
| // Gets the path the pattern matches with the leading slash. This can have
|
| // embedded asterisks which are interpreted using glob rules.
|
| @@ -162,21 +174,7 @@ class URLPattern {
|
|
|
| // Returns true if this pattern matches all urls.
|
| bool match_all_urls() const { return match_all_urls_; }
|
| - void set_match_all_urls(bool val) { match_all_urls_ = val; }
|
| -
|
| - // 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);
|
| + void SetMatchAllURLs(bool val);
|
|
|
| // Sets the scheme for pattern matches. This can be a single '*' if the
|
| // pattern matches all valid schemes (as defined by the valid_schemes_
|
| @@ -211,7 +209,7 @@ class URLPattern {
|
| const std::string& port() const { return port_; }
|
|
|
| // Returns a string representing this instance.
|
| - std::string GetAsString() const;
|
| + const std::string& GetAsString() const;
|
|
|
| // Determine whether there is a URL that would match this instance and another
|
| // instance. This method is symmetrical: Calling other.OverlapsWith(this)
|
| @@ -242,14 +240,6 @@ class URLPattern {
|
| static const char* GetParseResultString(URLPattern::ParseResult parse_result);
|
|
|
| private:
|
| -#if !(defined(_MSC_VER) && _MSC_VER >= 1600)
|
| - friend class std::vector<URLPattern>;
|
| -
|
| - // Note: don't use this directly. This exists so URLPattern can be used
|
| - // with STL containers.
|
| - URLPattern();
|
| -#endif
|
| -
|
| // Returns true if any of the |schemes| items matches our scheme.
|
| bool MatchesAnyScheme(const std::vector<std::string>& schemes) const;
|
|
|
| @@ -287,6 +277,9 @@ class URLPattern {
|
| // The path with "?" and "\" characters escaped for use with the
|
| // MatchPattern() function.
|
| std::string path_escaped_;
|
| +
|
| + // A string representing this URLPattern.
|
| + mutable std::string spec_;
|
| };
|
|
|
| typedef std::vector<URLPattern> URLPatternList;
|
|
|