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 <string> | 15 #include <string> |
16 | 16 |
| 17 #include "build/build_config.h" |
| 18 #if defined(OS_POSIX) |
| 19 #include "base/file_descriptor_posix.h" |
| 20 #endif |
| 21 #include "base/platform_file.h" |
17 #include "chrome/common/filter_policy.h" | 22 #include "chrome/common/filter_policy.h" |
18 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
19 #include "webkit/glue/resource_loader_bridge.h" | 24 #include "webkit/glue/resource_loader_bridge.h" |
20 | 25 |
21 namespace net { | 26 namespace net { |
22 class IOBuffer; | 27 class IOBuffer; |
23 } | 28 } |
24 | 29 |
25 // Parameters for a resource response header. | 30 // Parameters for a resource response header. |
26 struct ResourceResponseHead | 31 struct ResourceResponseHead |
27 : webkit_glue::ResourceLoaderBridge::ResponseInfo { | 32 : webkit_glue::ResourceLoaderBridge::ResponseInfo { |
28 // The response status. | 33 // The response status. |
29 URLRequestStatus status; | 34 URLRequestStatus status; |
30 | 35 |
31 // Specifies if the resource should be filtered before being displayed | 36 // Specifies if the resource should be filtered before being displayed |
32 // (insecure resources can be filtered to keep the page secure). | 37 // (insecure resources can be filtered to keep the page secure). |
33 FilterPolicy::Type filter_policy; | 38 FilterPolicy::Type filter_policy; |
| 39 |
| 40 // A platform specific handle for a file that carries response data. This |
| 41 // entry is used if the resource request is of type ResourceType::MEDIA and |
| 42 // the underlying cache layer keeps the response data in a standalone file. |
| 43 #if defined(OS_POSIX) |
| 44 // If the response data file is available, the file handle is stored in |
| 45 // response_data_file.fd, its value is base::kInvalidPlatformFileValue |
| 46 // otherwise. |
| 47 base::FileDescriptor response_data_file; |
| 48 #elif defined(OS_WIN) |
| 49 // An asynchronous file handle to the response data file, its value is |
| 50 // base::kInvalidPlatformFileValue if the file is not available. |
| 51 base::PlatformFile response_data_file; |
| 52 #endif |
34 }; | 53 }; |
35 | 54 |
36 // Parameters for a synchronous resource response. | 55 // Parameters for a synchronous resource response. |
37 struct SyncLoadResult : ResourceResponseHead { | 56 struct SyncLoadResult : ResourceResponseHead { |
38 // The final URL after any redirects. | 57 // The final URL after any redirects. |
39 GURL final_url; | 58 GURL final_url; |
40 | 59 |
41 // The response data. | 60 // The response data. |
42 std::string data; | 61 std::string data; |
43 }; | 62 }; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; | 102 virtual bool OnReadCompleted(int request_id, int* bytes_read) = 0; |
84 | 103 |
85 // The response is complete. The final response status is given. | 104 // The response is complete. The final response status is given. |
86 // Returns false if the handler is deferring the call to a later time. | 105 // Returns false if the handler is deferring the call to a later time. |
87 virtual bool OnResponseCompleted(int request_id, | 106 virtual bool OnResponseCompleted(int request_id, |
88 const URLRequestStatus& status, | 107 const URLRequestStatus& status, |
89 const std::string& security_info) = 0; | 108 const std::string& security_info) = 0; |
90 }; | 109 }; |
91 | 110 |
92 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ | 111 #endif // CHROME_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ |
OLD | NEW |