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

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

Issue 226663003: Allow content script insertion on about:-URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove permission warning for about:-scheme Created 6 years, 8 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
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 class GURL; 11 class GURL;
12 12
13 // A pattern that can be used to match URLs. A URLPattern is a very restricted 13 // A pattern that can be used to match URLs. A URLPattern is a very restricted
14 // subset of URL syntax: 14 // subset of URL syntax:
15 // 15 //
16 // <url-pattern> := <scheme>://<host><port><path> | '<all_urls>' 16 // <url-pattern> := <scheme>://<host><port><path> | '<all_urls>'
17 // <scheme> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome' | 17 // <scheme> := '*' | 'http' | 'https' | 'file' | 'ftp' | 'chrome' |
18 // 'chrome-extension' | 'filesystem' 18 // 'chrome-extension' | 'filesystem' | 'about'
19 // <host> := '*' | '*.' <anychar except '/' and '*'>+ 19 // <host> := '*' | '*.' <anychar except '/' and '*'>+
20 // <port> := [':' ('*' | <port number between 0 and 65535>)] 20 // <port> := [':' ('*' | <port number between 0 and 65535>)]
21 // <path> := '/' <any chars> 21 // <path> := '/' <any chars>
22 // 22 //
23 // * Host is not used when the scheme is 'file'. 23 // * Host is not used when the scheme is 'file'.
24 // * The path can have embedded '*' characters which act as glob wildcards. 24 // * The path can have embedded '*' characters which act as glob wildcards.
25 // * '<all_urls>' is a special pattern that matches any URL that contains a 25 // * '<all_urls>' is a special pattern that matches any URL that contains a
26 // valid scheme (as specified by valid_schemes_). 26 // valid scheme (as specified by valid_schemes_).
27 // * The '*' scheme pattern excludes file URLs. 27 // * The '*' scheme pattern excludes file URLs.
28 // 28 //
(...skipping 16 matching lines...) Expand all
45 // A collection of scheme bitmasks for use with valid_schemes. 45 // A collection of scheme bitmasks for use with valid_schemes.
46 enum SchemeMasks { 46 enum SchemeMasks {
47 SCHEME_NONE = 0, 47 SCHEME_NONE = 0,
48 SCHEME_HTTP = 1 << 0, 48 SCHEME_HTTP = 1 << 0,
49 SCHEME_HTTPS = 1 << 1, 49 SCHEME_HTTPS = 1 << 1,
50 SCHEME_FILE = 1 << 2, 50 SCHEME_FILE = 1 << 2,
51 SCHEME_FTP = 1 << 3, 51 SCHEME_FTP = 1 << 3,
52 SCHEME_CHROMEUI = 1 << 4, 52 SCHEME_CHROMEUI = 1 << 4,
53 SCHEME_EXTENSION = 1 << 5, 53 SCHEME_EXTENSION = 1 << 5,
54 SCHEME_FILESYSTEM = 1 << 6, 54 SCHEME_FILESYSTEM = 1 << 6,
55 SCHEME_ABOUT = 1 << 7,
55 56
56 // IMPORTANT! 57 // IMPORTANT!
57 // SCHEME_ALL will match every scheme, including chrome://, chrome- 58 // SCHEME_ALL will match every scheme, including chrome://, chrome-
58 // extension://, about:, etc. Because this has lots of security 59 // extension://, about:, etc. Because this has lots of security
59 // implications, third-party extensions should usually not be able to get 60 // implications, third-party extensions should usually not be able to get
60 // access to URL patterns initialized this way. If there is a reason 61 // access to URL patterns initialized this way. If there is a reason
61 // for violating this general rule, document why this it safe. 62 // for violating this general rule, document why this it safe.
62 SCHEME_ALL = -1, 63 SCHEME_ALL = -1,
63 }; 64 };
64 65
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // MatchPattern() function. 238 // MatchPattern() function.
238 std::string path_escaped_; 239 std::string path_escaped_;
239 240
240 // A string representing this URLPattern. 241 // A string representing this URLPattern.
241 mutable std::string spec_; 242 mutable std::string spec_;
242 }; 243 };
243 244
244 typedef std::vector<URLPattern> URLPatternList; 245 typedef std::vector<URLPattern> URLPatternList;
245 246
246 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ 247 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698