OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "net/base/net_api.h" |
17 #include "net/base/x509_cert_types.h" | 18 #include "net/base/x509_cert_types.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 // TransportSecurityState | 22 // TransportSecurityState |
22 // | 23 // |
23 // Tracks which hosts have enabled *-Transport-Security. This object manages | 24 // Tracks which hosts have enabled *-Transport-Security. This object manages |
24 // the in-memory store. A separate object must register itself with this object | 25 // the in-memory store. A separate object must register itself with this object |
25 // in order to persist the state to disk. | 26 // in order to persist the state to disk. |
26 class TransportSecurityState : | 27 class NET_API TransportSecurityState : |
27 public base::RefCountedThreadSafe<TransportSecurityState> { | 28 public base::RefCountedThreadSafe<TransportSecurityState> { |
28 public: | 29 public: |
29 // If non-empty, |hsts_hosts| is a JSON-formatted string to treat as if it | 30 // If non-empty, |hsts_hosts| is a JSON-formatted string to treat as if it |
30 // were a built-in entry (same format as persisted metadata in the | 31 // were a built-in entry (same format as persisted metadata in the |
31 // TransportSecurityState file). | 32 // TransportSecurityState file). |
32 explicit TransportSecurityState(const std::string& hsts_hosts); | 33 explicit TransportSecurityState(const std::string& hsts_hosts); |
33 | 34 |
34 // A DomainState is the information that we persist about a given domain. | 35 // A DomainState is the information that we persist about a given domain. |
35 struct DomainState { | 36 struct NET_API DomainState { |
36 enum Mode { | 37 enum Mode { |
37 // Strict mode implies: | 38 // Strict mode implies: |
38 // * We generate internal redirects from HTTP -> HTTPS. | 39 // * We generate internal redirects from HTTP -> HTTPS. |
39 // * Certificate issues are fatal. | 40 // * Certificate issues are fatal. |
40 MODE_STRICT = 0, | 41 MODE_STRICT = 0, |
41 // Opportunistic mode implies: | 42 // Opportunistic mode implies: |
42 // * We'll request HTTP URLs over HTTPS | 43 // * We'll request HTTP URLs over HTTPS |
43 // * Certificate issues are ignored. | 44 // * Certificate issues are ignored. |
44 MODE_OPPORTUNISTIC = 1, | 45 MODE_OPPORTUNISTIC = 1, |
45 // SPDY_ONLY (aka X-Bodge-Transport-Security) is a hopefully temporary | 46 // SPDY_ONLY (aka X-Bodge-Transport-Security) is a hopefully temporary |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 // Our delegate who gets notified when we are dirtied, or NULL. | 163 // Our delegate who gets notified when we are dirtied, or NULL. |
163 Delegate* delegate_; | 164 Delegate* delegate_; |
164 | 165 |
165 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 166 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
166 }; | 167 }; |
167 | 168 |
168 } // namespace net | 169 } // namespace net |
169 | 170 |
170 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ | 171 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
OLD | NEW |