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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // of the outer "filesystem:" part. | 146 // of the outer "filesystem:" part. |
147 bool MatchesScheme(const std::string& test) const; | 147 bool MatchesScheme(const std::string& test) const; |
148 | 148 |
149 // Returns true if |test| matches our host. | 149 // Returns true if |test| matches our host. |
150 bool MatchesHost(const std::string& test) const; | 150 bool MatchesHost(const std::string& test) const; |
151 bool MatchesHost(const GURL& test) const; | 151 bool MatchesHost(const GURL& test) const; |
152 | 152 |
153 // Returns true if |test| matches our path. | 153 // Returns true if |test| matches our path. |
154 bool MatchesPath(const std::string& test) const; | 154 bool MatchesPath(const std::string& test) const; |
155 | 155 |
| 156 // Returns true if the pattern is vague enough that it implies all hosts, |
| 157 // such as *://*/*. |
| 158 // This is an expensive method, and should be used sparingly! |
| 159 // You should probably use URLPatternSet::ShouldWarnAllHosts(), which is |
| 160 // cached. |
| 161 bool ImpliesAllHosts() const; |
| 162 |
156 // Sets the port. Returns false if the port is invalid. | 163 // Sets the port. Returns false if the port is invalid. |
157 bool SetPort(const std::string& port); | 164 bool SetPort(const std::string& port); |
158 const std::string& port() const { return port_; } | 165 const std::string& port() const { return port_; } |
159 | 166 |
160 // Returns a string representing this instance. | 167 // Returns a string representing this instance. |
161 const std::string& GetAsString() const; | 168 const std::string& GetAsString() const; |
162 | 169 |
163 // Determines whether there is a URL that would match this instance and | 170 // Determines whether there is a URL that would match this instance and |
164 // another instance. This method is symmetrical: Calling | 171 // another instance. This method is symmetrical: Calling |
165 // other.OverlapsWith(this) would result in the same answer. | 172 // other.OverlapsWith(this) would result in the same answer. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // MatchPattern() function. | 244 // MatchPattern() function. |
238 std::string path_escaped_; | 245 std::string path_escaped_; |
239 | 246 |
240 // A string representing this URLPattern. | 247 // A string representing this URLPattern. |
241 mutable std::string spec_; | 248 mutable std::string spec_; |
242 }; | 249 }; |
243 | 250 |
244 typedef std::vector<URLPattern> URLPatternList; | 251 typedef std::vector<URLPattern> URLPatternList; |
245 | 252 |
246 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 253 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
OLD | NEW |