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 <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Returns true if |test| matches our path. | 155 // Returns true if |test| matches our path. |
156 bool MatchesPath(const std::string& test) const; | 156 bool MatchesPath(const std::string& test) const; |
157 | 157 |
158 // Returns true if the pattern is vague enough that it implies all hosts, | 158 // Returns true if the pattern is vague enough that it implies all hosts, |
159 // such as *://*/*. | 159 // such as *://*/*. |
160 // This is an expensive method, and should be used sparingly! | 160 // This is an expensive method, and should be used sparingly! |
161 // You should probably use URLPatternSet::ShouldWarnAllHosts(), which is | 161 // You should probably use URLPatternSet::ShouldWarnAllHosts(), which is |
162 // cached. | 162 // cached. |
163 bool ImpliesAllHosts() const; | 163 bool ImpliesAllHosts() const; |
164 | 164 |
| 165 // Returns true if the pattern only matches a single origin. The pattern may |
| 166 // include a path. |
| 167 bool MatchesSingleOrigin() const; |
| 168 |
165 // Sets the port. Returns false if the port is invalid. | 169 // Sets the port. Returns false if the port is invalid. |
166 bool SetPort(const std::string& port); | 170 bool SetPort(const std::string& port); |
167 const std::string& port() const { return port_; } | 171 const std::string& port() const { return port_; } |
168 | 172 |
169 // Returns a string representing this instance. | 173 // Returns a string representing this instance. |
170 const std::string& GetAsString() const; | 174 const std::string& GetAsString() const; |
171 | 175 |
172 // Determines whether there is a URL that would match this instance and | 176 // Determines whether there is a URL that would match this instance and |
173 // another instance. This method is symmetrical: Calling | 177 // another instance. This method is symmetrical: Calling |
174 // other.OverlapsWith(this) would result in the same answer. | 178 // other.OverlapsWith(this) would result in the same answer. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 252 |
249 // A string representing this URLPattern. | 253 // A string representing this URLPattern. |
250 mutable std::string spec_; | 254 mutable std::string spec_; |
251 }; | 255 }; |
252 | 256 |
253 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); | 257 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); |
254 | 258 |
255 typedef std::vector<URLPattern> URLPatternList; | 259 typedef std::vector<URLPattern> URLPatternList; |
256 | 260 |
257 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 261 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
OLD | NEW |