OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 | 11 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // | 70 // |
71 // So, we can support at least half of current @include lines without supporting | 71 // So, we can support at least half of current @include lines without supporting |
72 // subdomain matching. We can pick up at least another 10% by supporting | 72 // subdomain matching. We can pick up at least another 10% by supporting |
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_FILE = 1 << 2, |
84 SCHEME_FTP = 1 << 3, | 84 SCHEME_FTP = 1 << 3, |
85 SCHEME_CHROMEUI = 1 << 4, | 85 SCHEME_CHROMEUI = 1 << 4, |
| 86 SCHEME_FILESYSTEM = 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 // Options for URLPattern::Parse(). | 95 // Options for URLPattern::Parse(). |
95 enum ParseOption { | 96 enum ParseOption { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 std::string path_; | 258 std::string path_; |
258 | 259 |
259 // The path with "?" and "\" characters escaped for use with the | 260 // The path with "?" and "\" characters escaped for use with the |
260 // MatchPattern() function. | 261 // MatchPattern() function. |
261 std::string path_escaped_; | 262 std::string path_escaped_; |
262 }; | 263 }; |
263 | 264 |
264 typedef std::vector<URLPattern> URLPatternList; | 265 typedef std::vector<URLPattern> URLPatternList; |
265 | 266 |
266 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ | 267 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
OLD | NEW |