| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BASE_TRANSPORT_SECURITY_STATE_H_ | 5 #ifndef NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
| 6 #define NET_BASE_TRANSPORT_SECURITY_STATE_H_ | 6 #define NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~Delegate() {} | 83 virtual ~Delegate() {} |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 void SetDelegate(Delegate*); | 86 void SetDelegate(Delegate*); |
| 87 | 87 |
| 88 bool Serialise(std::string* output); | 88 bool Serialise(std::string* output); |
| 89 bool Deserialise(const std::string& state, bool* dirty); | 89 bool Deserialise(const std::string& state, bool* dirty); |
| 90 | 90 |
| 91 // The maximum number of seconds for which we'll cache an HSTS request. |
| 92 static const long int kMaxHSTSAgeSecs; |
| 93 |
| 91 private: | 94 private: |
| 92 friend class base::RefCountedThreadSafe<TransportSecurityState>; | 95 friend class base::RefCountedThreadSafe<TransportSecurityState>; |
| 93 FRIEND_TEST_ALL_PREFIXES(TransportSecurityStateTest, IsPreloaded); | 96 FRIEND_TEST_ALL_PREFIXES(TransportSecurityStateTest, IsPreloaded); |
| 94 | 97 |
| 95 ~TransportSecurityState(); | 98 ~TransportSecurityState(); |
| 96 | 99 |
| 97 // If we have a callback configured, call it to let our serialiser know that | 100 // If we have a callback configured, call it to let our serialiser know that |
| 98 // our state is dirty. | 101 // our state is dirty. |
| 99 void DirtyNotify(); | 102 void DirtyNotify(); |
| 100 | 103 |
| 101 // The set of hosts that have enabled TransportSecurity. The keys here | 104 // The set of hosts that have enabled TransportSecurity. The keys here |
| 102 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form | 105 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form |
| 103 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" | 106 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" |
| 104 std::map<std::string, DomainState> enabled_hosts_; | 107 std::map<std::string, DomainState> enabled_hosts_; |
| 105 | 108 |
| 106 // Our delegate who gets notified when we are dirtied, or NULL. | 109 // Our delegate who gets notified when we are dirtied, or NULL. |
| 107 Delegate* delegate_; | 110 Delegate* delegate_; |
| 108 | 111 |
| 109 static std::string CanonicaliseHost(const std::string& host); | 112 static std::string CanonicaliseHost(const std::string& host); |
| 110 static bool IsPreloadedSTS(const std::string& canonicalised_host, | 113 static bool IsPreloadedSTS(const std::string& canonicalised_host, |
| 111 bool* out_include_subdomains); | 114 bool* out_include_subdomains); |
| 112 | 115 |
| 113 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 116 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
| 114 }; | 117 }; |
| 115 | 118 |
| 116 } // namespace net | 119 } // namespace net |
| 117 | 120 |
| 118 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ | 121 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
| OLD | NEW |