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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Adds a pattern to the set. Returns true if a new pattern was inserted, | 63 // Adds a pattern to the set. Returns true if a new pattern was inserted, |
64 // false if the pattern was already in the set. | 64 // false if the pattern was already in the set. |
65 bool AddPattern(const URLPattern& pattern); | 65 bool AddPattern(const URLPattern& pattern); |
66 | 66 |
67 // Adds all patterns from |set| into this. | 67 // Adds all patterns from |set| into this. |
68 void AddPatterns(const URLPatternSet& set); | 68 void AddPatterns(const URLPatternSet& set); |
69 | 69 |
70 void ClearPatterns(); | 70 void ClearPatterns(); |
71 | 71 |
| 72 // Adds |origin| to the set. |
| 73 bool AddOrigin(int valid_schemes, const GURL& origin); |
| 74 |
72 // Returns true if every URL that matches |set| is matched by this. In other | 75 // 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. | 76 // words, if every pattern in |set| is encompassed by a pattern in this. |
74 bool Contains(const URLPatternSet& set) const; | 77 bool Contains(const URLPatternSet& set) const; |
75 | 78 |
76 // Returns true if any pattern in this set encompasses |pattern|. | 79 // Returns true if any pattern in this set encompasses |pattern|. |
77 bool ContainsPattern(const URLPattern& pattern) const; | 80 bool ContainsPattern(const URLPattern& pattern) const; |
78 | 81 |
79 // Test if the extent contains a URL. | 82 // Test if the extent contains a URL. |
80 bool MatchesURL(const GURL& url) const; | 83 bool MatchesURL(const GURL& url) const; |
81 | 84 |
(...skipping 23 matching lines...) Expand all Loading... |
105 // The list of URL patterns that comprise the extent. | 108 // The list of URL patterns that comprise the extent. |
106 std::set<URLPattern> patterns_; | 109 std::set<URLPattern> patterns_; |
107 }; | 110 }; |
108 | 111 |
109 std::ostream& operator<<(std::ostream& out, | 112 std::ostream& operator<<(std::ostream& out, |
110 const URLPatternSet& url_pattern_set); | 113 const URLPatternSet& url_pattern_set); |
111 | 114 |
112 } // namespace extensions | 115 } // namespace extensions |
113 | 116 |
114 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 117 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
OLD | NEW |