| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ | 4 #ifndef CHROME_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ |
| 5 #define CHROME_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ | 5 #define CHROME_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ |
| 6 | 6 |
| 7 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
| 8 | 8 |
| 9 // A pattern that can be used to match URLs. A URLPattern is a very restricted | 9 // A pattern that can be used to match URLs. A URLPattern is a very restricted |
| 10 // subset of URL syntax: | 10 // subset of URL syntax: |
| 11 // | 11 // |
| 12 // <url-pattern> := <scheme>://<host><path> | 12 // <url-pattern> := <scheme>://<host><path> |
| 13 // <scheme> := 'http' | 'https' | 'file' | 'ftp' | 'chrome-ui' | 13 // <scheme> := 'http' | 'https' | 'file' | 'ftp' | 'chrome' |
| 14 // <host> := '*' | '*.' <anychar except '/' and '*'>+ | 14 // <host> := '*' | '*.' <anychar except '/' and '*'>+ |
| 15 // <path> := '/' <any chars> | 15 // <path> := '/' <any chars> |
| 16 // | 16 // |
| 17 // * Host is not used when the scheme is 'file'. | 17 // * Host is not used when the scheme is 'file'. |
| 18 // * The path can have embedded '*' characters which act as glob wildcards. | 18 // * The path can have embedded '*' characters which act as glob wildcards. |
| 19 // | 19 // |
| 20 // Examples of valid patterns: | 20 // Examples of valid patterns: |
| 21 // - http://*/* | 21 // - http://*/* |
| 22 // - http://*/foo* | 22 // - http://*/foo* |
| 23 // - https://*.google.com/foo*bar | 23 // - https://*.google.com/foo*bar |
| 24 // - chrome-ui://foo/bar | 24 // - chrome://foo/bar |
| 25 // - file://monkey* | 25 // - file://monkey* |
| 26 // - http://127.0.0.1/* | 26 // - http://127.0.0.1/* |
| 27 // | 27 // |
| 28 // Examples of invalid patterns: | 28 // Examples of invalid patterns: |
| 29 // - http://* -- path not specified | 29 // - http://* -- path not specified |
| 30 // - http://*foo/bar -- * not allowed as substring of host component | 30 // - http://*foo/bar -- * not allowed as substring of host component |
| 31 // - http://foo.*.bar/baz -- * must be first component | 31 // - http://foo.*.bar/baz -- * must be first component |
| 32 // - http:/bar -- scheme separator not found | 32 // - http:/bar -- scheme separator not found |
| 33 // - foo://* -- invalid scheme | 33 // - foo://* -- invalid scheme |
| 34 // | 34 // |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // everything after the scheme in the case of file:// URLs. | 115 // everything after the scheme in the case of file:// URLs. |
| 116 std::string path_; | 116 std::string path_; |
| 117 | 117 |
| 118 // The path with "?" and "\" characters escaped for use with the | 118 // The path with "?" and "\" characters escaped for use with the |
| 119 // MatchPattern() function. This is populated lazily, the first time it is | 119 // MatchPattern() function. This is populated lazily, the first time it is |
| 120 // needed. | 120 // needed. |
| 121 std::string path_escaped_; | 121 std::string path_escaped_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 #endif // CHROME_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ | 124 #endif // CHROME_BROWSER_EXTENSIONS_MATCH_PATTERN_H_ |
| OLD | NEW |