| 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 // This is the browser side of the resource dispatcher, it receives requests | 5 // This is the browser side of the resource dispatcher, it receives requests |
| 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then | 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then |
| 7 // fowards the messages from the URLRequests back to the correct process for | 7 // fowards the messages from the URLRequests back to the correct process for |
| 8 // handling. | 8 // handling. |
| 9 // | 9 // |
| 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // OnWillRead. A return value of false cancels the request, true continues | 85 // OnWillRead. A return value of false cancels the request, true continues |
| 86 // reading data. Set |*defer| to true to defer reading more response data. | 86 // reading data. Set |*defer| to true to defer reading more response data. |
| 87 // Call controller()->Resume() to continue reading response data. A zero | 87 // Call controller()->Resume() to continue reading response data. A zero |
| 88 // |bytes_read| signals that no further data is available. | 88 // |bytes_read| signals that no further data is available. |
| 89 virtual bool OnReadCompleted(int bytes_read, bool* defer) = 0; | 89 virtual bool OnReadCompleted(int bytes_read, bool* defer) = 0; |
| 90 | 90 |
| 91 // The response is complete. The final response status is given. Set | 91 // The response is complete. The final response status is given. Set |
| 92 // |*defer| to true to defer destruction to a later time. Otherwise, the | 92 // |*defer| to true to defer destruction to a later time. Otherwise, the |
| 93 // request will be destroyed upon return. | 93 // request will be destroyed upon return. |
| 94 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 94 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
| 95 const std::string& security_info, | |
| 96 bool* defer) = 0; | 95 bool* defer) = 0; |
| 97 | 96 |
| 98 // This notification is synthesized by the RedirectToFileResourceHandler | 97 // This notification is synthesized by the RedirectToFileResourceHandler |
| 99 // to indicate progress of 'download_to_file' requests. OnReadCompleted | 98 // to indicate progress of 'download_to_file' requests. OnReadCompleted |
| 100 // calls are consumed by the RedirectToFileResourceHandler and replaced | 99 // calls are consumed by the RedirectToFileResourceHandler and replaced |
| 101 // with OnDataDownloaded calls. | 100 // with OnDataDownloaded calls. |
| 102 virtual void OnDataDownloaded(int bytes_downloaded) = 0; | 101 virtual void OnDataDownloaded(int bytes_downloaded) = 0; |
| 103 | 102 |
| 104 protected: | 103 protected: |
| 105 ResourceHandler(net::URLRequest* request); | 104 ResourceHandler(net::URLRequest* request); |
| 106 | 105 |
| 107 ResourceController* controller() const { return controller_; } | 106 ResourceController* controller() const { return controller_; } |
| 108 net::URLRequest* request() const { return request_; } | 107 net::URLRequest* request() const { return request_; } |
| 109 | 108 |
| 110 // Convenience functions. | 109 // Convenience functions. |
| 111 ResourceRequestInfoImpl* GetRequestInfo() const; | 110 ResourceRequestInfoImpl* GetRequestInfo() const; |
| 112 int GetRequestID() const; | 111 int GetRequestID() const; |
| 113 ResourceMessageFilter* GetFilter() const; | 112 ResourceMessageFilter* GetFilter() const; |
| 114 | 113 |
| 115 private: | 114 private: |
| 116 ResourceController* controller_; | 115 ResourceController* controller_; |
| 117 net::URLRequest* request_; | 116 net::URLRequest* request_; |
| 118 }; | 117 }; |
| 119 | 118 |
| 120 } // namespace content | 119 } // namespace content |
| 121 | 120 |
| 122 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 121 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
| OLD | NEW |