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/net_export.h" |
18 #include "net/base/x509_cert_types.h" | 18 #include "net/base/x509_cert_types.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 // TransportSecurityState | 22 // TransportSecurityState |
23 // | 23 // |
24 // Tracks which hosts have enabled *-Transport-Security. This object manages | 24 // Tracks which hosts have enabled *-Transport-Security. This object manages |
25 // 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 |
26 // in order to persist the state to disk. | 26 // in order to persist the state to disk. |
27 class NET_API TransportSecurityState : | 27 class NET_EXPORT TransportSecurityState : |
28 public base::RefCountedThreadSafe<TransportSecurityState> { | 28 public base::RefCountedThreadSafe<TransportSecurityState> { |
29 public: | 29 public: |
30 // 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 |
31 // 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 |
32 // TransportSecurityState file). | 32 // TransportSecurityState file). |
33 explicit TransportSecurityState(const std::string& hsts_hosts); | 33 explicit TransportSecurityState(const std::string& hsts_hosts); |
34 | 34 |
35 // 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. |
36 struct NET_API DomainState { | 36 struct NET_EXPORT DomainState { |
37 enum Mode { | 37 enum Mode { |
38 // Strict mode implies: | 38 // Strict mode implies: |
39 // * We generate internal redirects from HTTP -> HTTPS. | 39 // * We generate internal redirects from HTTP -> HTTPS. |
40 // * Certificate issues are fatal. | 40 // * Certificate issues are fatal. |
41 MODE_STRICT = 0, | 41 MODE_STRICT = 0, |
42 // Opportunistic mode implies: | 42 // Opportunistic mode implies: |
43 // * We'll request HTTP URLs over HTTPS | 43 // * We'll request HTTP URLs over HTTPS |
44 // * Certificate issues are ignored. | 44 // * Certificate issues are ignored. |
45 MODE_OPPORTUNISTIC = 1, | 45 MODE_OPPORTUNISTIC = 1, |
46 // 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... |
162 | 162 |
163 // Our delegate who gets notified when we are dirtied, or NULL. | 163 // Our delegate who gets notified when we are dirtied, or NULL. |
164 Delegate* delegate_; | 164 Delegate* delegate_; |
165 | 165 |
166 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); | 166 DISALLOW_COPY_AND_ASSIGN(TransportSecurityState); |
167 }; | 167 }; |
168 | 168 |
169 } // namespace net | 169 } // namespace net |
170 | 170 |
171 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ | 171 #endif // NET_BASE_TRANSPORT_SECURITY_STATE_H_ |
OLD | NEW |