| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 void SetDelegate(Delegate*); | 87 void SetDelegate(Delegate*); |
| 88 | 88 |
| 89 bool Serialise(std::string* output); | 89 bool Serialise(std::string* output); |
| 90 bool Deserialise(const std::string& state, bool* dirty); | 90 bool Deserialise(const std::string& state, bool* dirty); |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 friend class base::RefCountedThreadSafe<TransportSecurityState>; | 93 friend class base::RefCountedThreadSafe<TransportSecurityState>; |
| 94 FRIEND_TEST_ALL_PREFIXES(TransportSecurityStateTest, IsPreloaded); | 94 FRIEND_TEST_ALL_PREFIXES(TransportSecurityStateTest, IsPreloaded); |
| 95 | 95 |
| 96 ~TransportSecurityState() {} | 96 ~TransportSecurityState(); |
| 97 | 97 |
| 98 // If we have a callback configured, call it to let our serialiser know that | 98 // If we have a callback configured, call it to let our serialiser know that |
| 99 // our state is dirty. | 99 // our state is dirty. |
| 100 void DirtyNotify(); | 100 void DirtyNotify(); |
| 101 | 101 |
| 102 // The set of hosts that have enabled TransportSecurity. The keys here | 102 // The set of hosts that have enabled TransportSecurity. The keys here |
| 103 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form | 103 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form |
| 104 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" | 104 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" |
| 105 std::map<std::string, DomainState> enabled_hosts_; | 105 std::map<std::string, DomainState> enabled_hosts_; |
| 106 | 106 |
| 107 // Our delegate who gets notified when we are dirtied, or NULL. | 107 // Our delegate who gets notified when we are dirtied, or NULL. |
| 108 Delegate* delegate_; | 108 Delegate* delegate_; |
| 109 | 109 |
| 110 static std::string CanonicaliseHost(const std::string& host); | 110 static std::string CanonicaliseHost(const std::string& host); |
| 111 static bool IsPreloadedSTS(const std::string& canonicalised_host, | 111 static bool IsPreloadedSTS(const std::string& canonicalised_host, |
| 112 bool* out_include_subdomains); | 112 bool* out_include_subdomains); |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 114 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace net | 117 } // namespace net |
| 118 | 118 |
| 119 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ | 119 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
| OLD | NEW |