OLD | NEW |
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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 PARSE_ERROR_EMPTY_HOST, | 71 PARSE_ERROR_EMPTY_HOST, |
72 PARSE_ERROR_INVALID_HOST_WILDCARD, | 72 PARSE_ERROR_INVALID_HOST_WILDCARD, |
73 PARSE_ERROR_EMPTY_PATH, | 73 PARSE_ERROR_EMPTY_PATH, |
74 PARSE_ERROR_INVALID_PORT, | 74 PARSE_ERROR_INVALID_PORT, |
75 NUM_PARSE_RESULTS | 75 NUM_PARSE_RESULTS |
76 }; | 76 }; |
77 | 77 |
78 // The <all_urls> string pattern. | 78 // The <all_urls> string pattern. |
79 static const char kAllUrlsPattern[]; | 79 static const char kAllUrlsPattern[]; |
80 | 80 |
| 81 // Returns true if the given |scheme| is considered valid for extensions. |
| 82 static bool IsValidSchemeForExtensions(const std::string& scheme); |
| 83 |
81 explicit URLPattern(int valid_schemes); | 84 explicit URLPattern(int valid_schemes); |
82 | 85 |
83 // Convenience to construct a URLPattern from a string. If the string is not | 86 // Convenience to construct a URLPattern from a string. If the string is not |
84 // known ahead of time, use Parse() instead, which returns success or failure. | 87 // known ahead of time, use Parse() instead, which returns success or failure. |
85 URLPattern(int valid_schemes, const std::string& pattern); | 88 URLPattern(int valid_schemes, const std::string& pattern); |
86 | 89 |
87 URLPattern(); | 90 URLPattern(); |
88 ~URLPattern(); | 91 ~URLPattern(); |
89 | 92 |
90 bool operator<(const URLPattern& other) const; | 93 bool operator<(const URLPattern& other) const; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // MatchPattern() function. | 237 // MatchPattern() function. |
235 std::string path_escaped_; | 238 std::string path_escaped_; |
236 | 239 |
237 // A string representing this URLPattern. | 240 // A string representing this URLPattern. |
238 mutable std::string spec_; | 241 mutable std::string spec_; |
239 }; | 242 }; |
240 | 243 |
241 typedef std::vector<URLPattern> URLPatternList; | 244 typedef std::vector<URLPattern> URLPatternList; |
242 | 245 |
243 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 246 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
OLD | NEW |