| 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 "base/timer/timer.h" |
| 11 #include "content/browser/loader/resource_handler.h" | 12 #include "content/browser/loader/resource_handler.h" |
| 12 #include "content/browser/ssl/ssl_error_handler.h" | 13 #include "content/browser/ssl/ssl_error_handler.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/resource_controller.h" | 15 #include "content/public/browser/resource_controller.h" |
| 15 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 class ClientCertStore; | 19 class ClientCertStore; |
| 19 } | 20 } |
| 20 | 21 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 public ResourceController { | 33 public ResourceController { |
| 33 public: | 34 public: |
| 34 ResourceLoader(scoped_ptr<net::URLRequest> request, | 35 ResourceLoader(scoped_ptr<net::URLRequest> request, |
| 35 scoped_ptr<ResourceHandler> handler, | 36 scoped_ptr<ResourceHandler> handler, |
| 36 ResourceLoaderDelegate* delegate); | 37 ResourceLoaderDelegate* delegate); |
| 37 virtual ~ResourceLoader(); | 38 virtual ~ResourceLoader(); |
| 38 | 39 |
| 39 void StartRequest(); | 40 void StartRequest(); |
| 40 void CancelRequest(bool from_renderer); | 41 void CancelRequest(bool from_renderer); |
| 41 | 42 |
| 43 // Start a timer to cancel the request in the future. |
| 44 void CancelAfterTimeout(); |
| 45 |
| 42 void ReportUploadProgress(); | 46 void ReportUploadProgress(); |
| 43 | 47 |
| 44 bool is_transferring() const { return is_transferring_; } | 48 bool is_transferring() const { return is_transferring_; } |
| 45 void MarkAsTransferring(const GURL& target_url); | 49 void MarkAsTransferring(const GURL& target_url); |
| 46 void CompleteTransfer(); | 50 void CompleteTransfer(); |
| 47 | 51 |
| 48 net::URLRequest* request() { return request_.get(); } | 52 net::URLRequest* request() { return request_.get(); } |
| 49 ResourceRequestInfoImpl* GetRequestInfo(); | 53 ResourceRequestInfoImpl* GetRequestInfo(); |
| 50 | 54 |
| 51 void ClearLoginDelegate(); | 55 void ClearLoginDelegate(); |
| 52 void ClearSSLClientAuthHandler(); | 56 void ClearSSLClientAuthHandler(); |
| 53 | 57 |
| 54 // IPC message handlers: | 58 // IPC message handlers: |
| 55 void OnUploadProgressACK(); | 59 void OnUploadProgressACK(); |
| 56 | 60 |
| 61 void set_detachable_delay_ms(int delay) { detachable_delay_ms_ = delay; } |
| 62 |
| 57 private: | 63 private: |
| 58 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); | 64 FRIEND_TEST_ALL_PREFIXES(ResourceLoaderTest, ClientCertStoreLookup); |
| 59 | 65 |
| 60 ResourceLoader(scoped_ptr<net::URLRequest> request, | 66 ResourceLoader(scoped_ptr<net::URLRequest> request, |
| 61 scoped_ptr<ResourceHandler> handler, | 67 scoped_ptr<ResourceHandler> handler, |
| 62 ResourceLoaderDelegate* delegate, | 68 ResourceLoaderDelegate* delegate, |
| 63 scoped_ptr<net::ClientCertStore> client_cert_store); | 69 scoped_ptr<net::ClientCertStore> client_cert_store); |
| 64 | 70 |
| 65 // Initialization logic shared between the public and private constructor. | 71 // Initialization logic shared between the public and private constructor. |
| 66 void Init(scoped_ptr<net::URLRequest> request, | 72 void Init(scoped_ptr<net::URLRequest> request, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 90 virtual void ContinueSSLRequest(const GlobalRequestID& id) OVERRIDE; | 96 virtual void ContinueSSLRequest(const GlobalRequestID& id) OVERRIDE; |
| 91 | 97 |
| 92 // ResourceController implementation: | 98 // ResourceController implementation: |
| 93 virtual void Resume() OVERRIDE; | 99 virtual void Resume() OVERRIDE; |
| 94 virtual void Cancel() OVERRIDE; | 100 virtual void Cancel() OVERRIDE; |
| 95 virtual void CancelAndIgnore() OVERRIDE; | 101 virtual void CancelAndIgnore() OVERRIDE; |
| 96 virtual void CancelWithError(int error_code) OVERRIDE; | 102 virtual void CancelWithError(int error_code) OVERRIDE; |
| 97 | 103 |
| 98 void StartRequestInternal(); | 104 void StartRequestInternal(); |
| 99 void CancelRequestInternal(int error, bool from_renderer); | 105 void CancelRequestInternal(int error, bool from_renderer); |
| 106 |
| 100 void CompleteResponseStarted(); | 107 void CompleteResponseStarted(); |
| 101 void StartReading(bool is_continuation); | 108 void StartReading(bool is_continuation); |
| 102 void ResumeReading(); | 109 void ResumeReading(); |
| 103 void ReadMore(int* bytes_read); | 110 void ReadMore(int* bytes_read); |
| 104 void CompleteRead(int bytes_read); | 111 void CompleteRead(int bytes_read); |
| 105 void ResponseCompleted(); | 112 void ResponseCompleted(); |
| 106 void CallDidFinishLoading(); | 113 void CallDidFinishLoading(); |
| 107 | 114 |
| 108 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } | 115 bool is_deferred() const { return deferred_stage_ != DEFERRED_NONE; } |
| 109 | 116 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 126 uint64 last_upload_position_; | 133 uint64 last_upload_position_; |
| 127 bool waiting_for_upload_progress_ack_; | 134 bool waiting_for_upload_progress_ack_; |
| 128 base::TimeTicks last_upload_ticks_; | 135 base::TimeTicks last_upload_ticks_; |
| 129 base::TimeTicks read_deferral_start_time_; | 136 base::TimeTicks read_deferral_start_time_; |
| 130 | 137 |
| 131 // Indicates that we are in a state of being transferred to a new downstream | 138 // Indicates that we are in a state of being transferred to a new downstream |
| 132 // consumer. We are waiting for a notification to complete the transfer, at | 139 // consumer. We are waiting for a notification to complete the transfer, at |
| 133 // which point we'll receive a new ResourceHandler. | 140 // which point we'll receive a new ResourceHandler. |
| 134 bool is_transferring_; | 141 bool is_transferring_; |
| 135 | 142 |
| 143 int detachable_delay_ms_; |
| 144 |
| 145 scoped_ptr<base::OneShotTimer<ResourceLoader> > detached_timer_; |
| 146 |
| 136 scoped_ptr<net::ClientCertStore> client_cert_store_; | 147 scoped_ptr<net::ClientCertStore> client_cert_store_; |
| 137 | 148 |
| 138 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; | 149 base::WeakPtrFactory<ResourceLoader> weak_ptr_factory_; |
| 139 | 150 |
| 140 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 151 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 141 }; | 152 }; |
| 142 | 153 |
| 143 } // namespace content | 154 } // namespace content |
| 144 | 155 |
| 145 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ | 156 #endif // CONTENT_BROWSER_LOADER_RESOURCE_LOADER_H_ |
| OLD | NEW |