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 // Test if the extent matches all URLs (for example, <all_urls>) | |
Devlin
2014/07/21 23:43:53
nit: .
aboxhall
2014/07/22 17:00:09
Done.
| |
83 bool MatchesAllURLs() const; | |
84 | |
82 bool MatchesSecurityOrigin(const GURL& origin) const; | 85 bool MatchesSecurityOrigin(const GURL& origin) const; |
83 | 86 |
84 // Returns true if there is a single URL that would be in two extents. | 87 // Returns true if there is a single URL that would be in two extents. |
85 bool OverlapsWith(const URLPatternSet& other) const; | 88 bool OverlapsWith(const URLPatternSet& other) const; |
86 | 89 |
87 // Converts to and from Value for serialization to preferences. | 90 // Converts to and from Value for serialization to preferences. |
88 scoped_ptr<base::ListValue> ToValue() const; | 91 scoped_ptr<base::ListValue> ToValue() const; |
89 bool Populate(const base::ListValue& value, | 92 bool Populate(const base::ListValue& value, |
90 int valid_schemes, | 93 int valid_schemes, |
91 bool allow_file_access, | 94 bool allow_file_access, |
92 std::string* error); | 95 std::string* error); |
93 | 96 |
97 // Converts to and from a vector of strings. | |
98 scoped_ptr<std::vector<std::string> > ToStringVector() const; | |
94 bool Populate(const std::vector<std::string>& patterns, | 99 bool Populate(const std::vector<std::string>& patterns, |
95 int valid_schemes, | 100 int valid_schemes, |
96 bool allow_file_access, | 101 bool allow_file_access, |
97 std::string* error); | 102 std::string* error); |
98 | 103 |
99 private: | 104 private: |
100 // The list of URL patterns that comprise the extent. | 105 // The list of URL patterns that comprise the extent. |
101 std::set<URLPattern> patterns_; | 106 std::set<URLPattern> patterns_; |
102 }; | 107 }; |
103 | 108 |
104 std::ostream& operator<<(std::ostream& out, | 109 std::ostream& operator<<(std::ostream& out, |
105 const URLPatternSet& url_pattern_set); | 110 const URLPatternSet& url_pattern_set); |
106 | 111 |
107 } // namespace extensions | 112 } // namespace extensions |
108 | 113 |
109 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 114 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
OLD | NEW |