OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // the cookie. | 78 // the cookie. |
79 base::Callback<bool(const net::CanonicalCookie& cookie)> | 79 base::Callback<bool(const net::CanonicalCookie& cookie)> |
80 BuildCookieFilter() const override; | 80 BuildCookieFilter() const override; |
81 | 81 |
82 // Builds a filter that matches channel IDs whose server identifiers are | 82 // Builds a filter that matches channel IDs whose server identifiers are |
83 // identical to one of the registrable domains that are in the whitelist, | 83 // identical to one of the registrable domains that are in the whitelist, |
84 // or are not in the blacklist. | 84 // or are not in the blacklist. |
85 base::Callback<bool(const std::string& cookie)> | 85 base::Callback<bool(const std::string& cookie)> |
86 BuildChannelIDFilter() const override; | 86 BuildChannelIDFilter() const override; |
87 | 87 |
| 88 // Builds a filter that matches plugins whose |site|s are registrable domains |
| 89 // that are in the whitelist, or are not in the blacklist. |
| 90 base::Callback<bool(const std::string& site)> |
| 91 BuildPluginFilter() const override; |
| 92 |
88 // Used for testing. | 93 // Used for testing. |
89 bool operator==(const RegistrableDomainFilterBuilder& other) const; | 94 bool operator==(const RegistrableDomainFilterBuilder& other) const; |
90 | 95 |
91 protected: | 96 protected: |
92 bool IsEmpty() const override; | 97 bool IsEmpty() const override; |
93 | 98 |
94 private: | 99 private: |
95 // True if the domain of |url| is in the whitelist, or isn't in the blacklist. | 100 // True if the domain of |url| is in the whitelist, or isn't in the blacklist. |
96 // The whitelist or blacklist is represented as |registerable_domains| | 101 // The whitelist or blacklist is represented as |registerable_domains| |
97 // and |mode|. | 102 // and |mode|. |
(...skipping 18 matching lines...) Expand all Loading... |
116 const net::CanonicalCookie& cookie); | 121 const net::CanonicalCookie& cookie); |
117 | 122 |
118 // True if none of the supplied domains matches this Channel ID's server ID | 123 // True if none of the supplied domains matches this Channel ID's server ID |
119 // and we're a blacklist, or one of them does and we're a whitelist. | 124 // and we're a blacklist, or one of them does and we're a whitelist. |
120 // The whitelist or blacklist is represented as |domains_and_ips| and |mode|. | 125 // The whitelist or blacklist is represented as |domains_and_ips| and |mode|. |
121 static bool MatchesChannelIDForRegisterableDomainsAndIPs( | 126 static bool MatchesChannelIDForRegisterableDomainsAndIPs( |
122 std::set<std::string>* domains_and_ips, | 127 std::set<std::string>* domains_and_ips, |
123 Mode mode, | 128 Mode mode, |
124 const std::string& channel_id_server_id); | 129 const std::string& channel_id_server_id); |
125 | 130 |
| 131 // True if none of the supplied domains matches this plugin's |site| and we're |
| 132 // a blacklist, or one of them does and we're a whitelist. The whitelist or |
| 133 // blacklist is represented by |domains_and_ips| and |mode|. |
| 134 static bool MatchesPluginSiteForRegisterableDomainsAndIPs( |
| 135 std::set<std::string>* domains_and_ips, |
| 136 Mode mode, |
| 137 const std::string& site); |
| 138 |
126 // The list of domains and whether they should be interpreted as a whitelist | 139 // The list of domains and whether they should be interpreted as a whitelist |
127 // or blacklist. | 140 // or blacklist. |
128 std::set<std::string> domain_list_; | 141 std::set<std::string> domain_list_; |
129 | 142 |
130 DISALLOW_COPY_AND_ASSIGN(RegistrableDomainFilterBuilder); | 143 DISALLOW_COPY_AND_ASSIGN(RegistrableDomainFilterBuilder); |
131 }; | 144 }; |
132 | 145 |
133 #endif // CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ | 146 #endif // CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ |
OLD | NEW |