| 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 MatchesSingleOrigin() const; |
| 167 |
| 165 // Sets the port. Returns false if the port is invalid. | 168 // Sets the port. Returns false if the port is invalid. |
| 166 bool SetPort(const std::string& port); | 169 bool SetPort(const std::string& port); |
| 167 const std::string& port() const { return port_; } | 170 const std::string& port() const { return port_; } |
| 168 | 171 |
| 169 // Returns a string representing this instance. | 172 // Returns a string representing this instance. |
| 170 const std::string& GetAsString() const; | 173 const std::string& GetAsString() const; |
| 171 | 174 |
| 172 // Determines whether there is a URL that would match this instance and | 175 // Determines whether there is a URL that would match this instance and |
| 173 // another instance. This method is symmetrical: Calling | 176 // another instance. This method is symmetrical: Calling |
| 174 // other.OverlapsWith(this) would result in the same answer. | 177 // other.OverlapsWith(this) would result in the same answer. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 251 |
| 249 // A string representing this URLPattern. | 252 // A string representing this URLPattern. |
| 250 mutable std::string spec_; | 253 mutable std::string spec_; |
| 251 }; | 254 }; |
| 252 | 255 |
| 253 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); | 256 std::ostream& operator<<(std::ostream& out, const URLPattern& url_pattern); |
| 254 | 257 |
| 255 typedef std::vector<URLPattern> URLPatternList; | 258 typedef std::vector<URLPattern> URLPatternList; |
| 256 | 259 |
| 257 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 260 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
| OLD | NEW |