| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| 11 #include <memory> |
| 11 #include <set> | 12 #include <set> |
| 12 | 13 |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "extensions/common/url_pattern.h" | 14 #include "extensions/common/url_pattern.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class ListValue; | 19 class ListValue; |
| 20 class Value; | 20 class Value; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Test if the extent matches all URLs (for example, <all_urls>). | 93 // Test if the extent matches all URLs (for example, <all_urls>). |
| 94 bool MatchesAllURLs() const; | 94 bool MatchesAllURLs() const; |
| 95 | 95 |
| 96 bool MatchesSecurityOrigin(const GURL& origin) const; | 96 bool MatchesSecurityOrigin(const GURL& origin) const; |
| 97 | 97 |
| 98 // Returns true if there is a single URL that would be in two extents. | 98 // Returns true if there is a single URL that would be in two extents. |
| 99 bool OverlapsWith(const URLPatternSet& other) const; | 99 bool OverlapsWith(const URLPatternSet& other) const; |
| 100 | 100 |
| 101 // Converts to and from Value for serialization to preferences. | 101 // Converts to and from Value for serialization to preferences. |
| 102 scoped_ptr<base::ListValue> ToValue() const; | 102 std::unique_ptr<base::ListValue> ToValue() const; |
| 103 bool Populate(const base::ListValue& value, | 103 bool Populate(const base::ListValue& value, |
| 104 int valid_schemes, | 104 int valid_schemes, |
| 105 bool allow_file_access, | 105 bool allow_file_access, |
| 106 std::string* error); | 106 std::string* error); |
| 107 | 107 |
| 108 // Converts to and from a vector of strings. | 108 // Converts to and from a vector of strings. |
| 109 scoped_ptr<std::vector<std::string> > ToStringVector() const; | 109 std::unique_ptr<std::vector<std::string>> ToStringVector() const; |
| 110 bool Populate(const std::vector<std::string>& patterns, | 110 bool Populate(const std::vector<std::string>& patterns, |
| 111 int valid_schemes, | 111 int valid_schemes, |
| 112 bool allow_file_access, | 112 bool allow_file_access, |
| 113 std::string* error); | 113 std::string* error); |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 // The list of URL patterns that comprise the extent. | 116 // The list of URL patterns that comprise the extent. |
| 117 std::set<URLPattern> patterns_; | 117 std::set<URLPattern> patterns_; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 std::ostream& operator<<(std::ostream& out, | 120 std::ostream& operator<<(std::ostream& out, |
| 121 const URLPatternSet& url_pattern_set); | 121 const URLPatternSet& url_pattern_set); |
| 122 | 122 |
| 123 } // namespace extensions | 123 } // namespace extensions |
| 124 | 124 |
| 125 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ | 125 #endif // EXTENSIONS_COMMON_URL_PATTERN_SET_H_ |
| OLD | NEW |