| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ | 4 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
| 5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ | 5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
| 6 #pragma once | 6 #pragma once |
| 7 | 7 |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // subdomain matching. It is probably possible to coerce more of the existing | 73 // subdomain matching. It is probably possible to coerce more of the existing |
| 74 // patterns to URLPattern, but the resulting pattern will be more restrictive | 74 // patterns to URLPattern, but the resulting pattern will be more restrictive |
| 75 // than the original glob, which is probably better than nothing. | 75 // than the original glob, which is probably better than nothing. |
| 76 class URLPattern { | 76 class URLPattern { |
| 77 public: | 77 public: |
| 78 // A collection of scheme bitmasks for use with valid_schemes. | 78 // A collection of scheme bitmasks for use with valid_schemes. |
| 79 enum SchemeMasks { | 79 enum SchemeMasks { |
| 80 SCHEME_NONE = 0, | 80 SCHEME_NONE = 0, |
| 81 SCHEME_HTTP = 1 << 0, | 81 SCHEME_HTTP = 1 << 0, |
| 82 SCHEME_HTTPS = 1 << 1, | 82 SCHEME_HTTPS = 1 << 1, |
| 83 SCHEME_FILE = 1 << 2, | 83 SCHEME_HTTPSV = 1 << 2, |
| 84 SCHEME_FTP = 1 << 3, | 84 SCHEME_FILE = 1 << 3, |
| 85 SCHEME_CHROMEUI = 1 << 4, | 85 SCHEME_FTP = 1 << 4, |
| 86 SCHEME_CHROMEUI = 1 << 5, |
| 86 // SCHEME_ALL will match every scheme, including chrome://, chrome- | 87 // SCHEME_ALL will match every scheme, including chrome://, chrome- |
| 87 // extension://, about:, etc. Because this has lots of security | 88 // extension://, about:, etc. Because this has lots of security |
| 88 // implications, third-party extensions should never be able to get access | 89 // implications, third-party extensions should never be able to get access |
| 89 // to URL patterns initialized this way. It should only be used for internal | 90 // to URL patterns initialized this way. It should only be used for internal |
| 90 // Chrome code. | 91 // Chrome code. |
| 91 SCHEME_ALL = -1, | 92 SCHEME_ALL = -1, |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 // Error codes returned from Parse(). | 95 // Error codes returned from Parse(). |
| 95 enum ParseResult { | 96 enum ParseResult { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 243 |
| 243 // The path with "?" and "\" characters escaped for use with the | 244 // The path with "?" and "\" characters escaped for use with the |
| 244 // MatchPattern() function. This is populated lazily, the first time it is | 245 // MatchPattern() function. This is populated lazily, the first time it is |
| 245 // needed. | 246 // needed. |
| 246 mutable std::string path_escaped_; | 247 mutable std::string path_escaped_; |
| 247 }; | 248 }; |
| 248 | 249 |
| 249 typedef std::vector<URLPattern> URLPatternList; | 250 typedef std::vector<URLPattern> URLPatternList; |
| 250 | 251 |
| 251 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ | 252 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
| OLD | NEW |