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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 base::Callback<bool(const std::string& site)> | 90 base::Callback<bool(const std::string& site)> |
91 BuildPluginFilter() const override; | 91 BuildPluginFilter() const override; |
92 | 92 |
93 // Used for testing. | 93 // Used for testing. |
94 bool operator==(const RegistrableDomainFilterBuilder& other) const; | 94 bool operator==(const RegistrableDomainFilterBuilder& other) const; |
95 | 95 |
96 protected: | 96 protected: |
97 bool IsEmpty() const override; | 97 bool IsEmpty() const override; |
98 | 98 |
99 private: | 99 private: |
100 // True if the domain of |url| is in the whitelist, or isn't in the blacklist. | 100 // The set of domains that constitute the whitelist or the blacklist, |
101 // The whitelist or blacklist is represented as |registerable_domains| | 101 // depending on mode(). |
102 // and |mode|. | 102 std::set<std::string> domains_; |
103 static bool MatchesURL(std::set<std::string>* registerable_domains, | |
104 Mode mode, | |
105 const GURL& url); | |
106 | |
107 // True if the pattern something in the whitelist, or doesn't match something | |
108 // in the blacklist. | |
109 // The whitelist or blacklist is represented as |patterns|, and |mode|. | |
110 static bool MatchesWebsiteSettingsPattern( | |
111 std::vector<ContentSettingsPattern>* patterns, | |
112 Mode mode, | |
113 const ContentSettingsPattern& pattern); | |
114 | |
115 // True if no domains can see the given cookie and we're a blacklist, or any | |
116 // domains can see the cookie and we're a whitelist. | |
117 // The whitelist or blacklist is represented as |domains_and_ips| and |mode|. | |
118 static bool MatchesCookieForRegisterableDomainsAndIPs( | |
119 std::set<std::string>* domains_and_ips, | |
120 Mode mode, | |
121 const net::CanonicalCookie& cookie); | |
122 | |
123 // True if none of the supplied domains matches this Channel ID's server ID | |
124 // and we're a blacklist, or one of them does and we're a whitelist. | |
125 // The whitelist or blacklist is represented as |domains_and_ips| and |mode|. | |
126 static bool MatchesChannelIDForRegisterableDomainsAndIPs( | |
127 std::set<std::string>* domains_and_ips, | |
128 Mode mode, | |
129 const std::string& channel_id_server_id); | |
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 | |
139 // The list of domains and whether they should be interpreted as a whitelist | |
140 // or blacklist. | |
141 std::set<std::string> domain_list_; | |
142 | 103 |
143 DISALLOW_COPY_AND_ASSIGN(RegistrableDomainFilterBuilder); | 104 DISALLOW_COPY_AND_ASSIGN(RegistrableDomainFilterBuilder); |
144 }; | 105 }; |
145 | 106 |
146 #endif // CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ | 107 #endif // CHROME_BROWSER_BROWSING_DATA_REGISTRABLE_DOMAIN_FILTER_BUILDER_H_ |
OLD | NEW |