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 |
11 | 11 |
12 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ | 12 #ifndef CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ |
13 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ | 13 #define CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/ref_counted.h" | 16 #include "base/ref_counted.h" |
17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/filter_policy.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 20 #include "webkit/glue/resource_loader_bridge.h" |
20 | 21 |
21 // Simple wrapper that refcounts ViewMsg_Resource_ResponseHead. | 22 // Parameters for a resource response header. |
| 23 struct ResourceResponseHead |
| 24 : webkit_glue::ResourceLoaderBridge::ResponseInfo { |
| 25 // The response status. |
| 26 URLRequestStatus status; |
| 27 |
| 28 // Specifies if the resource should be filtered before being displayed |
| 29 // (insecure resources can be filtered to keep the page secure). |
| 30 FilterPolicy::Type filter_policy; |
| 31 }; |
| 32 |
| 33 // Parameters for a synchronous resource response. |
| 34 struct SyncLoadResult : ResourceResponseHead { |
| 35 // The final URL after any redirects. |
| 36 GURL final_url; |
| 37 |
| 38 // The response data. |
| 39 std::string data; |
| 40 }; |
| 41 |
| 42 // Simple wrapper that refcounts ResourceResponseHead. |
22 struct ResourceResponse : public base::RefCounted<ResourceResponse> { | 43 struct ResourceResponse : public base::RefCounted<ResourceResponse> { |
23 ViewMsg_Resource_ResponseHead response_head; | 44 ResourceResponseHead response_head; |
24 }; | 45 }; |
25 | 46 |
26 // The resource dispatcher host uses this interface to push load events to the | 47 // The resource dispatcher host uses this interface to push load events to the |
27 // renderer, allowing for differences in the types of IPC messages generated. | 48 // renderer, allowing for differences in the types of IPC messages generated. |
28 // See the implementations of this interface defined below. | 49 // See the implementations of this interface defined below. |
29 class ResourceHandler : public base::RefCounted<ResourceHandler> { | 50 class ResourceHandler : public base::RefCounted<ResourceHandler> { |
30 public: | 51 public: |
31 virtual ~ResourceHandler() {} | 52 virtual ~ResourceHandler() {} |
32 | 53 |
33 // Called as upload progress is made. | 54 // Called as upload progress is made. |
(...skipping 24 matching lines...) Expand all Loading... |
58 // reading data. | 79 // reading data. |
59 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; | 80 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; |
60 | 81 |
61 // The response is complete. The final response status is given. | 82 // The response is complete. The final response status is given. |
62 // Returns false if the handler is deferring the call to a later time. | 83 // Returns false if the handler is deferring the call to a later time. |
63 virtual bool OnResponseCompleted(int request_id, | 84 virtual bool OnResponseCompleted(int request_id, |
64 const URLRequestStatus& status) = 0; | 85 const URLRequestStatus& status) = 0; |
65 }; | 86 }; |
66 | 87 |
67 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ | 88 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ |
OLD | NEW |