Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: extensions/common/url_pattern.h

Issue 2449913002: Support WebSocket in WebRequest API. (Closed)
Patch Set: git cl format Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/common/extension.cc ('k') | extensions/common/url_pattern.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 // - http://* -- path not specified 40 // - http://* -- path not specified
41 // - http://*foo/bar -- * not allowed as substring of host component 41 // - http://*foo/bar -- * not allowed as substring of host component
42 // - http://foo.*.bar/baz -- * must be first component 42 // - http://foo.*.bar/baz -- * must be first component
43 // - http:/bar -- scheme separator not found 43 // - http:/bar -- scheme separator not found
44 // - foo://* -- invalid scheme 44 // - foo://* -- invalid scheme
45 // - chrome:// -- we don't support chrome internal URLs 45 // - chrome:// -- we don't support chrome internal URLs
46 class URLPattern { 46 class URLPattern {
47 public: 47 public:
48 // A collection of scheme bitmasks for use with valid_schemes. 48 // A collection of scheme bitmasks for use with valid_schemes.
49 enum SchemeMasks { 49 enum SchemeMasks {
50 SCHEME_NONE = 0, 50 SCHEME_NONE = 0,
51 SCHEME_HTTP = 1 << 0, 51 SCHEME_HTTP = 1 << 0,
52 SCHEME_HTTPS = 1 << 1, 52 SCHEME_HTTPS = 1 << 1,
53 SCHEME_FILE = 1 << 2, 53 SCHEME_FILE = 1 << 2,
54 SCHEME_FTP = 1 << 3, 54 SCHEME_FTP = 1 << 3,
55 SCHEME_CHROMEUI = 1 << 4, 55 SCHEME_CHROMEUI = 1 << 4,
56 SCHEME_EXTENSION = 1 << 5, 56 SCHEME_EXTENSION = 1 << 5,
57 SCHEME_FILESYSTEM = 1 << 6, 57 SCHEME_FILESYSTEM = 1 << 6,
58 SCHEME_WS = 1 << 7,
59 SCHEME_WSS = 1 << 8,
58 60
59 // IMPORTANT! 61 // IMPORTANT!
60 // SCHEME_ALL will match every scheme, including chrome://, chrome- 62 // SCHEME_ALL will match every scheme, including chrome://, chrome-
61 // extension://, about:, etc. Because this has lots of security 63 // extension://, about:, etc. Because this has lots of security
62 // implications, third-party extensions should usually not be able to get 64 // implications, third-party extensions should usually not be able to get
63 // access to URL patterns initialized this way. If there is a reason 65 // access to URL patterns initialized this way. If there is a reason
64 // for violating this general rule, document why this it safe. 66 // for violating this general rule, document why this it safe.
65 SCHEME_ALL = -1, 67 SCHEME_ALL = -1,
66 }; 68 };
67 69
68 // Error codes returned from Parse(). 70 // Error codes returned from Parse().
69 enum ParseResult { 71 enum ParseResult {
70 PARSE_SUCCESS = 0, 72 PARSE_SUCCESS = 0,
71 PARSE_ERROR_MISSING_SCHEME_SEPARATOR, 73 PARSE_ERROR_MISSING_SCHEME_SEPARATOR,
72 PARSE_ERROR_INVALID_SCHEME, 74 PARSE_ERROR_INVALID_SCHEME,
73 PARSE_ERROR_WRONG_SCHEME_SEPARATOR, 75 PARSE_ERROR_WRONG_SCHEME_SEPARATOR,
74 PARSE_ERROR_EMPTY_HOST, 76 PARSE_ERROR_EMPTY_HOST,
75 PARSE_ERROR_INVALID_HOST_WILDCARD, 77 PARSE_ERROR_INVALID_HOST_WILDCARD,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 257
256 // A string representing this URLPattern. 258 // A string representing this URLPattern.
257 mutable std::string spec_; 259 mutable std::string spec_;
258 }; 260 };
259 261
260 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); 262 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern);
261 263
262 typedef std::vector<URLPattern> URLPatternList; 264 typedef std::vector<URLPattern> URLPatternList;
263 265
264 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ 266 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_
OLDNEW
« no previous file with comments | « extensions/common/extension.cc ('k') | extensions/common/url_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698