| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_STRICT_TRANSPORT_SECURITY_STATE_H_ | 5 #ifndef NET_BASE_STRICT_TRANSPORT_SECURITY_STATE_H_ |
| 6 #define NET_BASE_STRICT_TRANSPORT_SECURITY_STATE_H_ | 6 #define NET_BASE_STRICT_TRANSPORT_SECURITY_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Thus it must not reenter the StrictTransportSecurityState object. | 59 // Thus it must not reenter the StrictTransportSecurityState object. |
| 60 virtual void StateIsDirty(StrictTransportSecurityState* state) = 0; | 60 virtual void StateIsDirty(StrictTransportSecurityState* state) = 0; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 void SetDelegate(Delegate*); | 63 void SetDelegate(Delegate*); |
| 64 | 64 |
| 65 bool Serialise(std::string* output); | 65 bool Serialise(std::string* output); |
| 66 bool Deserialise(const std::string& state); | 66 bool Deserialise(const std::string& state); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 friend class base::RefCountedThreadSafe<StrictTransportSecurityState>; |
| 70 |
| 71 ~StrictTransportSecurityState() {} |
| 72 |
| 69 // If we have a callback configured, call it to let our serialiser know that | 73 // If we have a callback configured, call it to let our serialiser know that |
| 70 // our state is dirty. | 74 // our state is dirty. |
| 71 void DirtyNotify(); | 75 void DirtyNotify(); |
| 72 | 76 |
| 73 // The set of hosts that have enabled StrictTransportSecurity. The keys here | 77 // The set of hosts that have enabled StrictTransportSecurity. The keys here |
| 74 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form | 78 // are SHA256(DNSForm(domain)) where DNSForm converts from dotted form |
| 75 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" | 79 // ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com" |
| 76 std::map<std::string, State> enabled_hosts_; | 80 std::map<std::string, State> enabled_hosts_; |
| 77 | 81 |
| 78 // Protect access to our data members with this lock. | 82 // Protect access to our data members with this lock. |
| 79 Lock lock_; | 83 Lock lock_; |
| 80 | 84 |
| 81 // Our delegate who gets notified when we are dirtied, or NULL. | 85 // Our delegate who gets notified when we are dirtied, or NULL. |
| 82 Delegate* delegate_; | 86 Delegate* delegate_; |
| 83 | 87 |
| 84 static std::string CanonicaliseHost(const std::string& host); | 88 static std::string CanonicaliseHost(const std::string& host); |
| 85 | 89 |
| 86 DISALLOW_COPY_AND_ASSIGN(StrictTransportSecurityState); | 90 DISALLOW_COPY_AND_ASSIGN(StrictTransportSecurityState); |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 } // namespace net | 93 } // namespace net |
| 90 | 94 |
| 91 #endif // NET_BASE_STRICT_TRANSPORT_SECURITY_STATE_H_ | 95 #endif // NET_BASE_STRICT_TRANSPORT_SECURITY_STATE_H_ |
| OLD | NEW |