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