| 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 | 4 |
| 5 #ifndef EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 5 #ifndef EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
| 6 #define EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 6 #define EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Returns true if every URL that matches |set| is matched by this. In other | 72 // Returns true if every URL that matches |set| is matched by this. In other |
| 73 // words, if every pattern in |set| is encompassed by a pattern in this. | 73 // words, if every pattern in |set| is encompassed by a pattern in this. |
| 74 bool Contains(const URLPatternSet& set) const; | 74 bool Contains(const URLPatternSet& set) const; |
| 75 | 75 |
| 76 // Returns true if any pattern in this set encompasses |pattern|. | 76 // Returns true if any pattern in this set encompasses |pattern|. |
| 77 bool ContainsPattern(const URLPattern& pattern) const; | 77 bool ContainsPattern(const URLPattern& pattern) const; |
| 78 | 78 |
| 79 // Test if the extent contains a URL. | 79 // Test if the extent contains a URL. |
| 80 bool MatchesURL(const GURL& url) const; | 80 bool MatchesURL(const GURL& url) const; |
| 81 | 81 |
| 82 bool MatchesAllURLs() const; |
| 83 |
| 82 bool MatchesSecurityOrigin(const GURL& origin) const; | 84 bool MatchesSecurityOrigin(const GURL& origin) const; |
| 83 | 85 |
| 84 // Returns true if there is a single URL that would be in two extents. | 86 // Returns true if there is a single URL that would be in two extents. |
| 85 bool OverlapsWith(const URLPatternSet& other) const; | 87 bool OverlapsWith(const URLPatternSet& other) const; |
| 86 | 88 |
| 87 // Converts to and from Value for serialization to preferences. | 89 // Converts to and from Value for serialization to preferences. |
| 88 scoped_ptr<base::ListValue> ToValue() const; | 90 scoped_ptr<base::ListValue> ToValue() const; |
| 89 bool Populate(const base::ListValue& value, | 91 bool Populate(const base::ListValue& value, |
| 90 int valid_schemes, | 92 int valid_schemes, |
| 91 bool allow_file_access, | 93 bool allow_file_access, |
| 92 std::string* error); | 94 std::string* error); |
| 93 | 95 |
| 96 // Converts to and from a vector of strings. |
| 97 scoped_ptr<std::vector<std::string> > ToStringVector() const; |
| 94 bool Populate(const std::vector<std::string>& patterns, | 98 bool Populate(const std::vector<std::string>& patterns, |
| 95 int valid_schemes, | 99 int valid_schemes, |
| 96 bool allow_file_access, | 100 bool allow_file_access, |
| 97 std::string* error); | 101 std::string* error); |
| 98 | 102 |
| 99 private: | 103 private: |
| 100 // The list of URL patterns that comprise the extent. | 104 // The list of URL patterns that comprise the extent. |
| 101 std::set<URLPattern> patterns_; | 105 std::set<URLPattern> patterns_; |
| 102 }; | 106 }; |
| 103 | 107 |
| 104 std::ostream& operator<<(std::ostream& out, | 108 std::ostream& operator<<(std::ostream& out, |
| 105 const URLPatternSet& url_pattern_set); | 109 const URLPatternSet& url_pattern_set); |
| 106 | 110 |
| 107 } // namespace extensions | 111 } // namespace extensions |
| 108 | 112 |
| 109 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 113 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
| OLD | NEW |