| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // Simple wrapper that refcounts ResourceResponseHead. | 47 // Simple wrapper that refcounts ResourceResponseHead. |
| 48 struct ResourceResponse : public base::RefCounted<ResourceResponse> { | 48 struct ResourceResponse : public base::RefCounted<ResourceResponse> { |
| 49 ResourceResponseHead response_head; | 49 ResourceResponseHead response_head; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // The resource dispatcher host uses this interface to push load events to the | 52 // The resource dispatcher host uses this interface to push load events to the |
| 53 // renderer, allowing for differences in the types of IPC messages generated. | 53 // renderer, allowing for differences in the types of IPC messages generated. |
| 54 // See the implementations of this interface defined below. | 54 // See the implementations of this interface defined below. |
| 55 class ResourceHandler : public base::RefCounted<ResourceHandler> { | 55 class ResourceHandler : public base::RefCountedThreadSafe<ResourceHandler> { |
| 56 public: | 56 public: |
| 57 virtual ~ResourceHandler() {} | 57 virtual ~ResourceHandler() {} |
| 58 | 58 |
| 59 // Called as upload progress is made. | 59 // Called as upload progress is made. |
| 60 virtual bool OnUploadProgress(int request_id, | 60 virtual bool OnUploadProgress(int request_id, |
| 61 uint64 position, | 61 uint64 position, |
| 62 uint64 size) { | 62 uint64 size) { |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 86 // Data (*bytes_read bytes) was written into the buffer provided by | 86 // Data (*bytes_read bytes) was written into the buffer provided by |
| 87 // OnWillRead. A return value of false cancels the request, true continues | 87 // OnWillRead. A return value of false cancels the request, true continues |
| 88 // reading data. | 88 // reading data. |
| 89 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; | 89 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; |
| 90 | 90 |
| 91 // The response is complete. The final response status is given. | 91 // The response is complete. The final response status is given. |
| 92 // Returns false if the handler is deferring the call to a later time. | 92 // Returns false if the handler is deferring the call to a later time. |
| 93 virtual bool OnResponseCompleted(int request_id, | 93 virtual bool OnResponseCompleted(int request_id, |
| 94 const URLRequestStatus& status, | 94 const URLRequestStatus& status, |
| 95 const std::string& security_info) = 0; | 95 const std::string& security_info) = 0; |
| 96 |
| 97 // Signals that the request is closed (i.e. finished successfully, cancelled). |
| 98 // This is a signal that the associated URLRequest isn't valid anymore. |
| 99 virtual void OnRequestClosed() { } |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ | 102 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ |
| OLD | NEW |