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 NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 5 #ifndef NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
6 #define NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 6 #define NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 void ClearDynamicData(); | 172 void ClearDynamicData(); |
173 | 173 |
174 // Inserts |state| into |enabled_hosts_| under the key |hashed_host|. | 174 // Inserts |state| into |enabled_hosts_| under the key |hashed_host|. |
175 // |hashed_host| is already in the internal representation | 175 // |hashed_host| is already in the internal representation |
176 // HashHost(CanonicalizeHost(host)). | 176 // HashHost(CanonicalizeHost(host)). |
177 // Note: This is only used for serializing/deserializing the | 177 // Note: This is only used for serializing/deserializing the |
178 // TransportSecurityState. | 178 // TransportSecurityState. |
179 void AddOrUpdateEnabledHosts(const std::string& hashed_host, | 179 void AddOrUpdateEnabledHosts(const std::string& hashed_host, |
180 const DomainState& state); | 180 const DomainState& state); |
181 | 181 |
182 // Inserts |state| into |forced_hosts_| under the key |hashed_host|. | |
183 // |hashed_host| is already in the internal representation | |
184 // HashHost(CanonicalizeHost(host)). | |
185 // Note: This is only used for serializing/deserializing the | |
186 // TransportSecurityState. | |
187 void AddOrUpdateForcedHosts(const std::string& hashed_host, | |
188 const DomainState& state); | |
189 | |
190 // Deletes all dynamic data (e.g. HSTS or HPKP data) created since a given | 182 // Deletes all dynamic data (e.g. HSTS or HPKP data) created since a given |
191 // time. | 183 // time. |
192 // | 184 // |
193 // If any entries are deleted, the new state will be persisted through | 185 // If any entries are deleted, the new state will be persisted through |
194 // the Delegate (if any). | 186 // the Delegate (if any). |
195 void DeleteAllDynamicDataSince(const base::Time& time); | 187 void DeleteAllDynamicDataSince(const base::Time& time); |
196 | 188 |
197 // Deletes any dynamic data stored for |host| (e.g. HSTS or HPKP data). | 189 // Deletes any dynamic data stored for |host| (e.g. HSTS or HPKP data). |
198 // If |host| doesn't have an exact entry then no action is taken. Does | 190 // If |host| doesn't have an exact entry then no action is taken. Does |
199 // not delete static (i.e. preloaded) data. Returns true iff an entry | 191 // not delete static (i.e. preloaded) data. Returns true iff an entry |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // | 295 // |
304 // Note that this method is not const because it opportunistically removes | 296 // Note that this method is not const because it opportunistically removes |
305 // entries that have expired. | 297 // entries that have expired. |
306 bool GetStaticDomainState(const std::string& host, | 298 bool GetStaticDomainState(const std::string& host, |
307 bool sni_enabled, | 299 bool sni_enabled, |
308 DomainState* result); | 300 DomainState* result); |
309 | 301 |
310 // The set of hosts that have enabled TransportSecurity. | 302 // The set of hosts that have enabled TransportSecurity. |
311 DomainStateMap enabled_hosts_; | 303 DomainStateMap enabled_hosts_; |
312 | 304 |
313 // Extra entries, provided by the user at run-time, to treat as if they | |
314 // were static. | |
315 DomainStateMap forced_hosts_; | |
316 | |
317 Delegate* delegate_; | 305 Delegate* delegate_; |
318 | 306 |
319 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 307 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
320 }; | 308 }; |
321 | 309 |
322 } // namespace net | 310 } // namespace net |
323 | 311 |
324 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ | 312 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_H_ |
OLD | NEW |