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