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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // If the handler returns false, then the request is cancelled. Otherwise, | 77 // If the handler returns false, then the request is cancelled. Otherwise, |
78 // once data is available, OnReadCompleted will be called. | 78 // once data is available, OnReadCompleted will be called. |
79 virtual bool OnWillRead(int request_id, | 79 virtual bool OnWillRead(int request_id, |
80 net::IOBuffer** buf, | 80 net::IOBuffer** buf, |
81 int* buf_size, | 81 int* buf_size, |
82 int min_size) = 0; | 82 int min_size) = 0; |
83 | 83 |
84 // Data (*bytes_read bytes) was written into the buffer provided by | 84 // Data (*bytes_read bytes) was written into the buffer provided by |
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 ResourceDispatcherHostImpl::ResumeDeferredRequest to continue reading | 87 // Call controller()->Resume() to continue reading response data. |
88 // response data. | |
89 virtual bool OnReadCompleted(int request_id, int bytes_read, | 88 virtual bool OnReadCompleted(int request_id, int bytes_read, |
90 bool* defer) = 0; | 89 bool* defer) = 0; |
91 | 90 |
92 // The response is complete. The final response status is given. Returns | 91 // The response is complete. The final response status is given. Returns |
93 // false if the handler is deferring the call to a later time. Otherwise, | 92 // false if the handler is deferring the call to a later time. Otherwise, |
94 // the request will be destroyed upon return. | 93 // the request will be destroyed upon return. |
95 virtual bool OnResponseCompleted(int request_id, | 94 virtual bool OnResponseCompleted(int request_id, |
96 const net::URLRequestStatus& status, | 95 const net::URLRequestStatus& status, |
97 const std::string& security_info) = 0; | 96 const std::string& security_info) = 0; |
98 | 97 |
99 // This notification is synthesized by the RedirectToFileResourceHandler | 98 // This notification is synthesized by the RedirectToFileResourceHandler |
100 // to indicate progress of 'download_to_file' requests. OnReadCompleted | 99 // to indicate progress of 'download_to_file' requests. OnReadCompleted |
101 // calls are consumed by the RedirectToFileResourceHandler and replaced | 100 // calls are consumed by the RedirectToFileResourceHandler and replaced |
102 // with OnDataDownloaded calls. | 101 // with OnDataDownloaded calls. |
103 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) = 0; | 102 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) = 0; |
104 | 103 |
105 protected: | 104 protected: |
106 ResourceHandler() : controller_(NULL) {} | 105 ResourceHandler() : controller_(NULL) {} |
107 ResourceController* controller() { return controller_; } | 106 ResourceController* controller() { return controller_; } |
108 | 107 |
109 private: | 108 private: |
110 ResourceController* controller_; | 109 ResourceController* controller_; |
111 }; | 110 }; |
112 | 111 |
113 } // namespace content | 112 } // namespace content |
114 | 113 |
115 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 114 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
OLD | NEW |