OLD | NEW |
1 // Copyright (c) 2011 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> |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 private: | 228 private: |
229 #if !(defined(_MSC_VER) && _MSC_VER >= 1600) | 229 #if !(defined(_MSC_VER) && _MSC_VER >= 1600) |
230 friend class std::vector<URLPattern>; | 230 friend class std::vector<URLPattern>; |
231 | 231 |
232 // Note: don't use this directly. This exists so URLPattern can be used | 232 // Note: don't use this directly. This exists so URLPattern can be used |
233 // with STL containers. | 233 // with STL containers. |
234 URLPattern(); | 234 URLPattern(); |
235 #endif | 235 #endif |
236 | 236 |
| 237 // Returns true if any of the |schemes| items matches our scheme. |
| 238 bool MatchesAnyScheme(const std::vector<std::string>& schemes) const; |
| 239 |
| 240 // If the URLPattern contains a wildcard scheme, returns a list of |
| 241 // equivalent literal schemes, otherwise returns the current scheme. |
| 242 std::vector<std::string> GetExplicitSchemes() const; |
| 243 |
237 // A bitmask containing the schemes which are considered valid for this | 244 // A bitmask containing the schemes which are considered valid for this |
238 // pattern. Parse() uses this to decide whether a pattern contains a valid | 245 // pattern. Parse() uses this to decide whether a pattern contains a valid |
239 // scheme. MatchesScheme uses this to decide whether a wildcard scheme_ | 246 // scheme. MatchesScheme uses this to decide whether a wildcard scheme_ |
240 // matches a given test scheme. | 247 // matches a given test scheme. |
241 int valid_schemes_; | 248 int valid_schemes_; |
242 | 249 |
243 // True if this is a special-case "<all_urls>" pattern. | 250 // True if this is a special-case "<all_urls>" pattern. |
244 bool match_all_urls_; | 251 bool match_all_urls_; |
245 | 252 |
246 // The scheme for the pattern. | 253 // The scheme for the pattern. |
(...skipping 11 matching lines...) Expand all Loading... |
258 std::string path_; | 265 std::string path_; |
259 | 266 |
260 // The path with "?" and "\" characters escaped for use with the | 267 // The path with "?" and "\" characters escaped for use with the |
261 // MatchPattern() function. | 268 // MatchPattern() function. |
262 std::string path_escaped_; | 269 std::string path_escaped_; |
263 }; | 270 }; |
264 | 271 |
265 typedef std::vector<URLPattern> URLPatternList; | 272 typedef std::vector<URLPattern> URLPatternList; |
266 | 273 |
267 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ | 274 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
OLD | NEW |