OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/browser/loader/resource_handler.h" | 11 #include "content/browser/loader/resource_handler.h" |
12 #include "content/browser/ssl/ssl_error_handler.h" | 12 #include "content/browser/ssl/ssl_error_handler.h" |
13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
14 #include "content/public/browser/resource_controller.h" | 14 #include "content/public/browser/resource_controller.h" |
15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" | 15 #include "content/public/common/signed_certificate_timestamp_id_and_status.h" |
16 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
17 | 17 |
18 namespace net { | |
19 class X509Certificate; | |
20 } | |
21 | |
22 namespace content { | 18 namespace content { |
23 class ResourceDispatcherHostLoginDelegate; | 19 class ResourceDispatcherHostLoginDelegate; |
24 class ResourceLoaderDelegate; | 20 class ResourceLoaderDelegate; |
25 class ResourceRequestInfoImpl; | 21 class ResourceRequestInfoImpl; |
26 class SSLClientAuthHandler; | 22 class SSLClientAuthHandler; |
27 | 23 |
28 // This class is responsible for driving the URLRequest (i.e., calling Start, | 24 // This class is responsible for driving the URLRequest (i.e., calling Start, |
29 // Read, and servicing events). It has a ResourceHandler, which is typically a | 25 // Read, and servicing events). It has a ResourceHandler, which is typically a |
30 // chain of ResourceHandlers, and is the ResourceController for its handler. | 26 // chain of ResourceHandlers, and is the ResourceController for its handler. |
31 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, | 27 class CONTENT_EXPORT ResourceLoader : public net::URLRequest::Delegate, |
(...skipping 11 matching lines...) Expand all Loading... |
43 void ReportUploadProgress(); | 39 void ReportUploadProgress(); |
44 | 40 |
45 bool is_transferring() const { return is_transferring_; } | 41 bool is_transferring() const { return is_transferring_; } |
46 void MarkAsTransferring(); | 42 void MarkAsTransferring(); |
47 void CompleteTransfer(); | 43 void CompleteTransfer(); |
48 | 44 |
49 net::URLRequest* request() { return request_.get(); } | 45 net::URLRequest* request() { return request_.get(); } |
50 ResourceRequestInfoImpl* GetRequestInfo(); | 46 ResourceRequestInfoImpl* GetRequestInfo(); |
51 | 47 |
52 void ClearLoginDelegate(); | 48 void ClearLoginDelegate(); |
| 49 void ClearSSLClientAuthHandler(); |
53 | 50 |
54 // IPC message handlers: | 51 // IPC message handlers: |
55 void OnUploadProgressACK(); | 52 void OnUploadProgressACK(); |
56 | 53 |
57 private: | 54 private: |
58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); | 55 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); |
59 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreNull); | 56 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreNull); |
60 | 57 |
61 // net::URLRequest::Delegate implementation: | 58 // net::URLRequest::Delegate implementation: |
62 virtual void OnReceivedRedirect(net::URLRequest* request, | 59 virtual void OnReceivedRedirect(net::URLRequest* request, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 SignedCertificateTimestampIDStatusList* sct_ids); | 95 SignedCertificateTimestampIDStatusList* sct_ids); |
99 void CompleteResponseStarted(); | 96 void CompleteResponseStarted(); |
100 void StartReading(bool is_continuation); | 97 void StartReading(bool is_continuation); |
101 void ResumeReading(); | 98 void ResumeReading(); |
102 void ReadMore(int* bytes_read); | 99 void ReadMore(int* bytes_read); |
103 // Passes a read result to the handler. | 100 // Passes a read result to the handler. |
104 void CompleteRead(int bytes_read); | 101 void CompleteRead(int bytes_read); |
105 void ResponseCompleted(); | 102 void ResponseCompleted(); |
106 void CallDidFinishLoading(); | 103 void CallDidFinishLoading(); |
107 void RecordHistograms(); | 104 void RecordHistograms(); |
108 void ContinueWithCertificate(net::X509Certificate* cert); | |
109 | 105 |
110 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } | 106 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } |
111 | 107 |
112 // Used for categorizing loading of prefetches for reporting in histograms. | 108 // Used for categorizing loading of prefetches for reporting in histograms. |
113 // NOTE: This enumeration is used in histograms, so please do not add entries | 109 // NOTE: This enumeration is used in histograms, so please do not add entries |
114 // in the middle. | 110 // in the middle. |
115 enum PrefetchStatus { | 111 enum PrefetchStatus { |
116 STATUS_UNDEFINED, | 112 STATUS_UNDEFINED, |
117 STATUS_SUCCESS_FROM_CACHE, | 113 STATUS_SUCCESS_FROM_CACHE, |
118 STATUS_SUCCESS_FROM_NETWORK, | 114 STATUS_SUCCESS_FROM_NETWORK, |
(...skipping 10 matching lines...) Expand all Loading... |
129 DEFERRED_RESPONSE_COMPLETE, | 125 DEFERRED_RESPONSE_COMPLETE, |
130 DEFERRED_FINISH | 126 DEFERRED_FINISH |
131 }; | 127 }; |
132 DeferredStage deferred_stage_; | 128 DeferredStage deferred_stage_; |
133 | 129 |
134 scoped_ptr<net::URLRequest> request_; | 130 scoped_ptr<net::URLRequest> request_; |
135 scoped_ptr<ResourceHandler> handler_; | 131 scoped_ptr<ResourceHandler> handler_; |
136 ResourceLoaderDelegate* delegate_; | 132 ResourceLoaderDelegate* delegate_; |
137 | 133 |
138 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; | 134 scoped_refptr<ResourceDispatcherHostLoginDelegate> login_delegate_; |
139 scoped_ptr<SSLClientAuthHandler> ssl_client_auth_handler_; | 135 scoped_refptr<SSLClientAuthHandler> ssl_client_auth_handler_; |
140 | 136 |
141 uint64 last_upload_position_; | 137 uint64 last_upload_position_; |
142 bool waiting_for_upload_progress_ack_; | 138 bool waiting_for_upload_progress_ack_; |
143 base::TimeTicks last_upload_ticks_; | 139 base::TimeTicks last_upload_ticks_; |
144 base::TimeTicks read_deferral_start_time_; | 140 base::TimeTicks read_deferral_start_time_; |
145 | 141 |
146 // Indicates that we are in a state of being transferred to a new downstream | 142 // Indicates that we are in a state of being transferred to a new downstream |
147 // consumer. We are waiting for a notification to complete the transfer, at | 143 // consumer. We are waiting for a notification to complete the transfer, at |
148 // which point we'll receive a new ResourceHandler. | 144 // which point we'll receive a new ResourceHandler. |
149 bool is_transferring_; | 145 bool is_transferring_; |
150 | 146 |
151 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 147 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
152 | 148 |
153 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 149 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
154 }; | 150 }; |
155 | 151 |
156 } // namespace content | 152 } // namespace content |
157 | 153 |
158 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 154 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
OLD | NEW |