OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // IPC messages for resource loading. |
| 6 // Multiply-included message file, hence no include guard. |
| 7 |
| 8 #include "base/shared_memory.h" |
| 9 #include "content/common/resource_response.h" |
| 10 #include "ipc/ipc_message_macros.h" |
| 11 #include "net/base/upload_data.h" |
| 12 |
| 13 namespace net { |
| 14 class UploadData; |
| 15 } |
| 16 |
| 17 #define IPC_MESSAGE_START ResourceMsgStart |
| 18 |
| 19 IPC_STRUCT_TRAITS_BEGIN(webkit_glue::ResourceResponseInfo) |
| 20 IPC_STRUCT_TRAITS_MEMBER(request_time) |
| 21 IPC_STRUCT_TRAITS_MEMBER(response_time) |
| 22 IPC_STRUCT_TRAITS_MEMBER(headers) |
| 23 IPC_STRUCT_TRAITS_MEMBER(mime_type) |
| 24 IPC_STRUCT_TRAITS_MEMBER(charset) |
| 25 IPC_STRUCT_TRAITS_MEMBER(security_info) |
| 26 IPC_STRUCT_TRAITS_MEMBER(content_length) |
| 27 IPC_STRUCT_TRAITS_MEMBER(appcache_id) |
| 28 IPC_STRUCT_TRAITS_MEMBER(appcache_manifest_url) |
| 29 IPC_STRUCT_TRAITS_MEMBER(connection_id) |
| 30 IPC_STRUCT_TRAITS_MEMBER(connection_reused) |
| 31 IPC_STRUCT_TRAITS_MEMBER(load_timing) |
| 32 IPC_STRUCT_TRAITS_MEMBER(devtools_info) |
| 33 IPC_STRUCT_TRAITS_MEMBER(download_file_path) |
| 34 IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_spdy) |
| 35 IPC_STRUCT_TRAITS_MEMBER(was_npn_negotiated) |
| 36 IPC_STRUCT_TRAITS_MEMBER(was_alternate_protocol_available) |
| 37 IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_proxy) |
| 38 IPC_STRUCT_TRAITS_MEMBER(socket_address) |
| 39 IPC_STRUCT_TRAITS_END() |
| 40 |
| 41 IPC_STRUCT_TRAITS_BEGIN(ResourceResponseHead) |
| 42 IPC_STRUCT_TRAITS_PARENT(webkit_glue::ResourceResponseInfo) |
| 43 IPC_STRUCT_TRAITS_MEMBER(status) |
| 44 IPC_STRUCT_TRAITS_END() |
| 45 |
| 46 IPC_STRUCT_TRAITS_BEGIN(SyncLoadResult) |
| 47 IPC_STRUCT_TRAITS_PARENT(ResourceResponseHead) |
| 48 IPC_STRUCT_TRAITS_MEMBER(final_url) |
| 49 IPC_STRUCT_TRAITS_MEMBER(data) |
| 50 IPC_STRUCT_TRAITS_END() |
| 51 |
| 52 // Parameters for a resource request. |
| 53 IPC_STRUCT_BEGIN(ResourceHostMsg_Request) |
| 54 // The request method: GET, POST, etc. |
| 55 IPC_STRUCT_MEMBER(std::string, method) |
| 56 |
| 57 // The requested URL. |
| 58 IPC_STRUCT_MEMBER(GURL, url) |
| 59 |
| 60 // Usually the URL of the document in the top-level window, which may be |
| 61 // checked by the third-party cookie blocking policy. Leaving it empty may |
| 62 // lead to undesired cookie blocking. Third-party cookie blocking can be |
| 63 // bypassed by setting first_party_for_cookies = url, but this should ideally |
| 64 // only be done if there really is no way to determine the correct value. |
| 65 IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) |
| 66 |
| 67 // The referrer to use (may be empty). |
| 68 IPC_STRUCT_MEMBER(GURL, referrer) |
| 69 |
| 70 // Additional HTTP request headers. |
| 71 IPC_STRUCT_MEMBER(std::string, headers) |
| 72 |
| 73 // net::URLRequest load flags (0 by default). |
| 74 IPC_STRUCT_MEMBER(int, load_flags) |
| 75 |
| 76 // Process ID from which this request originated, or zero if it originated |
| 77 // in the renderer itself. |
| 78 IPC_STRUCT_MEMBER(int, origin_pid) |
| 79 |
| 80 // What this resource load is for (main frame, sub-frame, sub-resource, |
| 81 // object). |
| 82 IPC_STRUCT_MEMBER(ResourceType::Type, resource_type) |
| 83 |
| 84 // Used by plugin->browser requests to get the correct net::URLRequestContext. |
| 85 IPC_STRUCT_MEMBER(uint32, request_context) |
| 86 |
| 87 // Indicates which frame (or worker context) the request is being loaded into, |
| 88 // or kNoHostId. |
| 89 IPC_STRUCT_MEMBER(int, appcache_host_id) |
| 90 |
| 91 // Optional upload data (may be null). |
| 92 IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data) |
| 93 |
| 94 IPC_STRUCT_MEMBER(bool, download_to_file) |
| 95 |
| 96 // True if the request was user initiated. |
| 97 IPC_STRUCT_MEMBER(bool, has_user_gesture) |
| 98 |
| 99 // The following two members are specified if the request is initiated by |
| 100 // a plugin like Gears. |
| 101 |
| 102 // Contains the id of the host renderer. |
| 103 IPC_STRUCT_MEMBER(int, host_renderer_id) |
| 104 |
| 105 // Contains the id of the host render view. |
| 106 IPC_STRUCT_MEMBER(int, host_render_view_id) |
| 107 IPC_STRUCT_END() |
| 108 |
| 109 // Resource messages sent from the browser to the renderer. |
| 110 |
| 111 // Sent when the headers are available for a resource request. |
| 112 IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedResponse, |
| 113 int /* request_id */, |
| 114 ResourceResponseHead) |
| 115 |
| 116 // Sent when cached metadata from a resource request is ready. |
| 117 IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedCachedMetadata, |
| 118 int /* request_id */, |
| 119 std::vector<char> /* data */) |
| 120 |
| 121 // Sent as upload progress is being made. |
| 122 IPC_MESSAGE_ROUTED3(ResourceMsg_UploadProgress, |
| 123 int /* request_id */, |
| 124 int64 /* position */, |
| 125 int64 /* size */) |
| 126 |
| 127 // Sent when the request has been redirected. The receiver is expected to |
| 128 // respond with either a FollowRedirect message (if the redirect is to be |
| 129 // followed) or a CancelRequest message (if it should not be followed). |
| 130 IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect, |
| 131 int /* request_id */, |
| 132 GURL /* new_url */, |
| 133 ResourceResponseHead) |
| 134 |
| 135 // Sent when some data from a resource request is ready. The handle should |
| 136 // already be mapped into the process that receives this message. |
| 137 IPC_MESSAGE_ROUTED3(ResourceMsg_DataReceived, |
| 138 int /* request_id */, |
| 139 base::SharedMemoryHandle /* data */, |
| 140 int /* data_len */) |
| 141 |
| 142 // Sent when some data from a resource request has been downloaded to |
| 143 // file. This is only called in the 'download_to_file' case and replaces |
| 144 // ResourceMsg_DataReceived in the call sequence in that case. |
| 145 IPC_MESSAGE_ROUTED2(ResourceMsg_DataDownloaded, |
| 146 int /* request_id */, |
| 147 int /* data_len */) |
| 148 |
| 149 // Sent when the request has been completed. |
| 150 IPC_MESSAGE_ROUTED4(ResourceMsg_RequestComplete, |
| 151 int /* request_id */, |
| 152 net::URLRequestStatus /* status */, |
| 153 std::string /* security info */, |
| 154 base::Time /* completion_time */) |
| 155 |
| 156 // Resource messages sent from the renderer to the browser. |
| 157 |
| 158 // Makes a resource request via the browser. |
| 159 IPC_MESSAGE_ROUTED2(ResourceHostMsg_RequestResource, |
| 160 int /* request_id */, |
| 161 ResourceHostMsg_Request) |
| 162 |
| 163 // Cancels a resource request with the ID given as the parameter. |
| 164 IPC_MESSAGE_ROUTED1(ResourceHostMsg_CancelRequest, |
| 165 int /* request_id */) |
| 166 |
| 167 // Follows a redirect that occured for the resource request with the ID given |
| 168 // as the parameter. |
| 169 IPC_MESSAGE_ROUTED3(ResourceHostMsg_FollowRedirect, |
| 170 int /* request_id */, |
| 171 bool /* has_new_first_party_for_cookies */, |
| 172 GURL /* new_first_party_for_cookies */) |
| 173 |
| 174 // Makes a synchronous resource request via the browser. |
| 175 IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, |
| 176 int /* request_id */, |
| 177 ResourceHostMsg_Request, |
| 178 SyncLoadResult) |
| 179 |
| 180 // Sent when the renderer process is done processing a DataReceived |
| 181 // message. |
| 182 IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataReceived_ACK, |
| 183 int /* request_id */) |
| 184 |
| 185 // Sent when the renderer has processed a DataDownloaded message. |
| 186 IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataDownloaded_ACK, |
| 187 int /* request_id */) |
| 188 |
| 189 // Sent by the renderer process to acknowledge receipt of a |
| 190 // UploadProgress message. |
| 191 IPC_MESSAGE_ROUTED1(ResourceHostMsg_UploadProgress_ACK, |
| 192 int /* request_id */) |
| 193 |
| 194 // Sent when the renderer process deletes a resource loader. |
| 195 IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, |
| 196 int /* request_id */) |
OLD | NEW |