| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 #ifndef EXTENSIONS_COMMON_URL_PATTERN_H_ | 4 #ifndef EXTENSIONS_COMMON_URL_PATTERN_H_ |
| 5 #define EXTENSIONS_COMMON_URL_PATTERN_H_ | 5 #define EXTENSIONS_COMMON_URL_PATTERN_H_ |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 bool MatchesSecurityOriginHelper(const GURL& test) const; | 216 bool MatchesSecurityOriginHelper(const GURL& test) const; |
| 217 | 217 |
| 218 // Returns true if our port matches the |port| pattern (it may be "*"). | 218 // Returns true if our port matches the |port| pattern (it may be "*"). |
| 219 bool MatchesPortPattern(const std::string& port) const; | 219 bool MatchesPortPattern(const std::string& port) const; |
| 220 | 220 |
| 221 // If the URLPattern contains a wildcard scheme, returns a list of | 221 // If the URLPattern contains a wildcard scheme, returns a list of |
| 222 // equivalent literal schemes, otherwise returns the current scheme. | 222 // equivalent literal schemes, otherwise returns the current scheme. |
| 223 std::vector<std::string> GetExplicitSchemes() const; | 223 std::vector<std::string> GetExplicitSchemes() const; |
| 224 | 224 |
| 225 // Adds or removes trailing dot to properly handle FQDN matching. |
| 226 std::string CanonicalizeHostForMatching(const GURL& url) const; |
| 227 |
| 225 // A bitmask containing the schemes which are considered valid for this | 228 // A bitmask containing the schemes which are considered valid for this |
| 226 // pattern. Parse() uses this to decide whether a pattern contains a valid | 229 // pattern. Parse() uses this to decide whether a pattern contains a valid |
| 227 // scheme. | 230 // scheme. |
| 228 int valid_schemes_; | 231 int valid_schemes_; |
| 229 | 232 |
| 230 // True if this is a special-case "<all_urls>" pattern. | 233 // True if this is a special-case "<all_urls>" pattern. |
| 231 bool match_all_urls_; | 234 bool match_all_urls_; |
| 232 | 235 |
| 233 // The scheme for the pattern. | 236 // The scheme for the pattern. |
| 234 std::string scheme_; | 237 std::string scheme_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 253 | 256 |
| 254 // A string representing this URLPattern. | 257 // A string representing this URLPattern. |
| 255 mutable std::string spec_; | 258 mutable std::string spec_; |
| 256 }; | 259 }; |
| 257 | 260 |
| 258 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); | 261 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); |
| 259 | 262 |
| 260 typedef std::vector<URLPattern> URLPatternList; | 263 typedef std::vector<URLPattern> URLPatternList; |
| 261 | 264 |
| 262 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 265 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
| OLD | NEW |