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. | |
166 bool IsOrigin() const; | |
not at google - send to devlin
2014/08/13 22:59:17
I'm silly. IsOrigin() is wrong, MatchesSingleOrigi
gpdavis
2014/08/13 23:23:06
Done.
| |
167 | |
168 // Returns the pattern's origin as a GURL. | |
169 GURL ToOrigin() const; | |
170 | |
165 // Sets the port. Returns false if the port is invalid. | 171 // Sets the port. Returns false if the port is invalid. |
166 bool SetPort(const std::string& port); | 172 bool SetPort(const std::string& port); |
167 const std::string& port() const { return port_; } | 173 const std::string& port() const { return port_; } |
168 | 174 |
169 // Returns a string representing this instance. | 175 // Returns a string representing this instance. |
170 const std::string& GetAsString() const; | 176 const std::string& GetAsString() const; |
171 | 177 |
172 // Determines whether there is a URL that would match this instance and | 178 // Determines whether there is a URL that would match this instance and |
173 // another instance. This method is symmetrical: Calling | 179 // another instance. This method is symmetrical: Calling |
174 // other.OverlapsWith(this) would result in the same answer. | 180 // other.OverlapsWith(this) would result in the same answer. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 | 254 |
249 // A string representing this URLPattern. | 255 // A string representing this URLPattern. |
250 mutable std::string spec_; | 256 mutable std::string spec_; |
251 }; | 257 }; |
252 | 258 |
253 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); | 259 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); |
254 | 260 |
255 typedef std::vector<URLPattern> URLPatternList; | 261 typedef std::vector<URLPattern> URLPatternList; |
256 | 262 |
257 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 263 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
OLD | NEW |