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_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 5 #ifndef NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
6 #define NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 6 #define NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/disk_cache/disk_cache.h" | 14 #include "net/disk_cache/disk_cache.h" |
15 #include "net/socket/ssl_host_info.h" | 15 #include "net/socket/ssl_host_info.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class HttpCache; | 19 class HttpCache; |
20 class IOBuffer; | 20 class IOBuffer; |
21 struct SSLConfig; | 21 struct SSLConfig; |
22 | 22 |
23 // DiskCacheBasedSSLHostInfo fetches information about an SSL host from our | 23 // DiskCacheBasedSSLHostInfo fetches information about an SSL host from our |
24 // standard disk cache. Since the information is defined to be non-sensitive, | 24 // standard disk cache. Since the information is defined to be non-sensitive, |
25 // it's ok for us to keep it on disk. | 25 // it's ok for us to keep it on disk. |
26 class DiskCacheBasedSSLHostInfo : public SSLHostInfo, | 26 class NET_EXPORT_PRIVATE DiskCacheBasedSSLHostInfo |
27 public base::NonThreadSafe { | 27 : public SSLHostInfo, |
| 28 public NON_EXPORTED_BASE(base::NonThreadSafe) { |
28 public: | 29 public: |
29 DiskCacheBasedSSLHostInfo(const std::string& hostname, | 30 DiskCacheBasedSSLHostInfo(const std::string& hostname, |
30 const SSLConfig& ssl_config, | 31 const SSLConfig& ssl_config, |
31 CertVerifier* cert_verifier, | 32 CertVerifier* cert_verifier, |
32 HttpCache* http_cache); | 33 HttpCache* http_cache); |
33 | 34 |
34 // Implementation of SSLHostInfo | 35 // Implementation of SSLHostInfo |
35 virtual void Start(); | 36 virtual void Start(); |
36 virtual int WaitForDataReady(CompletionCallback* callback); | 37 virtual int WaitForDataReady(CompletionCallback* callback); |
37 virtual void Persist(); | 38 virtual void Persist(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void (DiskCacheBasedSSLHostInfo::*meth_)(int); | 73 void (DiskCacheBasedSSLHostInfo::*meth_)(int); |
73 | 74 |
74 disk_cache::Backend* backend_; | 75 disk_cache::Backend* backend_; |
75 disk_cache::Entry* entry_; | 76 disk_cache::Entry* entry_; |
76 }; | 77 }; |
77 | 78 |
78 virtual ~DiskCacheBasedSSLHostInfo(); | 79 virtual ~DiskCacheBasedSSLHostInfo(); |
79 | 80 |
80 std::string key() const; | 81 std::string key() const; |
81 | 82 |
82 void DoLoop(int rv); | 83 void OnIOComplete(int rv); |
| 84 |
| 85 int DoLoop(int rv); |
83 | 86 |
84 int DoGetBackendComplete(int rv); | 87 int DoGetBackendComplete(int rv); |
85 int DoOpenComplete(int rv); | 88 int DoOpenComplete(int rv); |
86 int DoReadComplete(int rv); | 89 int DoReadComplete(int rv); |
87 int DoWriteComplete(int rv); | 90 int DoWriteComplete(int rv); |
88 int DoCreateComplete(int rv); | 91 int DoCreateComplete(int rv); |
89 | 92 |
90 int DoGetBackend(); | 93 int DoGetBackend(); |
91 int DoOpen(); | 94 int DoOpen(); |
92 int DoRead(); | 95 int DoRead(); |
(...skipping 12 matching lines...) Expand all Loading... |
105 base::WeakPtrFactory<DiskCacheBasedSSLHostInfo> weak_ptr_factory_; | 108 base::WeakPtrFactory<DiskCacheBasedSSLHostInfo> weak_ptr_factory_; |
106 CallbackImpl* callback_; | 109 CallbackImpl* callback_; |
107 State state_; | 110 State state_; |
108 bool ready_; | 111 bool ready_; |
109 std::string new_data_; | 112 std::string new_data_; |
110 const std::string hostname_; | 113 const std::string hostname_; |
111 HttpCache* const http_cache_; | 114 HttpCache* const http_cache_; |
112 disk_cache::Backend* backend_; | 115 disk_cache::Backend* backend_; |
113 disk_cache::Entry* entry_; | 116 disk_cache::Entry* entry_; |
114 CompletionCallback* user_callback_; | 117 CompletionCallback* user_callback_; |
115 scoped_refptr<net::IOBuffer> read_buffer_; | 118 scoped_refptr<IOBuffer> read_buffer_; |
116 scoped_refptr<net::IOBuffer> write_buffer_; | 119 scoped_refptr<IOBuffer> write_buffer_; |
117 std::string data_; | 120 std::string data_; |
118 }; | 121 }; |
119 | 122 |
120 } // namespace net | 123 } // namespace net |
121 | 124 |
122 #endif // NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ | 125 #endif // NET_HTTP_DISK_CACHE_BASED_SSL_HOST_INFO_H_ |
OLD | NEW |