blob: 523020611f0e78f2c0de19b80805e0534142224a [file] [log] [blame]
[email protected]94dc971d2011-03-05 19:08:321// 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.
[email protected]94dc971d2011-03-05 19:08:326
[email protected]e503a122011-03-17 18:20:527// Multiply-included message file, hence no include guard.
[email protected]94dc971d2011-03-05 19:08:328#include "base/shared_memory.h"
[email protected]19a5c7442011-10-21 20:00:419#include "content/public/common/common_param_traits.h"
[email protected]2336ffe2011-11-24 01:23:3410#include "content/public/common/resource_response.h"
[email protected]94dc971d2011-03-05 19:08:3211#include "ipc/ipc_message_macros.h"
12#include "net/base/upload_data.h"
13
[email protected]94dc971d2011-03-05 19:08:3214#define IPC_MESSAGE_START ResourceMsgStart
[email protected]03ff5e52011-09-30 00:28:1415#undef IPC_MESSAGE_EXPORT
16#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
[email protected]94dc971d2011-03-05 19:08:3217
[email protected]2336ffe2011-11-24 01:23:3418IPC_STRUCT_TRAITS_BEGIN(content::ResourceResponseHead)
19 IPC_STRUCT_TRAITS_PARENT(webkit_glue::ResourceResponseInfo)
20 IPC_STRUCT_TRAITS_MEMBER(status)
21IPC_STRUCT_TRAITS_END()
22
23IPC_STRUCT_TRAITS_BEGIN(content::SyncLoadResult)
24 IPC_STRUCT_TRAITS_PARENT(content::ResourceResponseHead)
25 IPC_STRUCT_TRAITS_MEMBER(final_url)
26 IPC_STRUCT_TRAITS_MEMBER(data)
27IPC_STRUCT_TRAITS_END()
28
[email protected]94dc971d2011-03-05 19:08:3229IPC_STRUCT_TRAITS_BEGIN(webkit_glue::ResourceResponseInfo)
30 IPC_STRUCT_TRAITS_MEMBER(request_time)
31 IPC_STRUCT_TRAITS_MEMBER(response_time)
32 IPC_STRUCT_TRAITS_MEMBER(headers)
33 IPC_STRUCT_TRAITS_MEMBER(mime_type)
34 IPC_STRUCT_TRAITS_MEMBER(charset)
35 IPC_STRUCT_TRAITS_MEMBER(security_info)
36 IPC_STRUCT_TRAITS_MEMBER(content_length)
[email protected]dfd682172011-04-13 19:57:2537 IPC_STRUCT_TRAITS_MEMBER(encoded_data_length)
[email protected]94dc971d2011-03-05 19:08:3238 IPC_STRUCT_TRAITS_MEMBER(appcache_id)
39 IPC_STRUCT_TRAITS_MEMBER(appcache_manifest_url)
40 IPC_STRUCT_TRAITS_MEMBER(connection_id)
41 IPC_STRUCT_TRAITS_MEMBER(connection_reused)
42 IPC_STRUCT_TRAITS_MEMBER(load_timing)
43 IPC_STRUCT_TRAITS_MEMBER(devtools_info)
44 IPC_STRUCT_TRAITS_MEMBER(download_file_path)
45 IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_spdy)
46 IPC_STRUCT_TRAITS_MEMBER(was_npn_negotiated)
47 IPC_STRUCT_TRAITS_MEMBER(was_alternate_protocol_available)
48 IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_proxy)
49 IPC_STRUCT_TRAITS_MEMBER(socket_address)
50IPC_STRUCT_TRAITS_END()
51
[email protected]94dc971d2011-03-05 19:08:3252// Parameters for a resource request.
53IPC_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)
[email protected]418da612011-07-21 19:01:5298
99 // True if |frame_id| is the main frame of a RenderView.
100 IPC_STRUCT_MEMBER(bool, is_main_frame)
101
102 // Identifies the frame within the RenderView that sent the request.
103 // -1 if unknown / invalid.
104 IPC_STRUCT_MEMBER(int64, frame_id)
[email protected]d88bf0a2011-08-30 23:55:57105
[email protected]91043a8232011-11-04 16:41:19106 // True if |parent_frame_id| is the main frame of a RenderView.
107 IPC_STRUCT_MEMBER(bool, parent_is_main_frame)
108
109 // Identifies the parent frame of the frame that sent the request.
110 // -1 if unknown / invalid.
111 IPC_STRUCT_MEMBER(int64, parent_frame_id)
112
[email protected]2905f742011-10-13 03:51:58113 IPC_STRUCT_MEMBER(content::PageTransition, transition_type)
[email protected]4ad5d77d2011-12-03 02:00:48114
115 // The following two members identify a previous request that has been
116 // created before this navigation has been transferred to a new render view.
117 // This serves the purpose of recycling the old request.
118 // Unless this refers to a transferred navigation, these values are -1 and -1.
119 IPC_STRUCT_MEMBER(int, transferred_request_child_id)
120 IPC_STRUCT_MEMBER(int, transferred_request_request_id)
[email protected]94dc971d2011-03-05 19:08:32121IPC_STRUCT_END()
122
123// Resource messages sent from the browser to the renderer.
124
125// Sent when the headers are available for a resource request.
126IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedResponse,
127 int /* request_id */,
[email protected]2336ffe2011-11-24 01:23:34128 content::ResourceResponseHead)
[email protected]94dc971d2011-03-05 19:08:32129
130// Sent when cached metadata from a resource request is ready.
131IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedCachedMetadata,
132 int /* request_id */,
133 std::vector<char> /* data */)
134
135// Sent as upload progress is being made.
136IPC_MESSAGE_ROUTED3(ResourceMsg_UploadProgress,
137 int /* request_id */,
138 int64 /* position */,
139 int64 /* size */)
140
141// Sent when the request has been redirected. The receiver is expected to
142// respond with either a FollowRedirect message (if the redirect is to be
143// followed) or a CancelRequest message (if it should not be followed).
144IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect,
145 int /* request_id */,
146 GURL /* new_url */,
[email protected]2336ffe2011-11-24 01:23:34147 content::ResourceResponseHead)
[email protected]94dc971d2011-03-05 19:08:32148
149// Sent when some data from a resource request is ready. The handle should
150// already be mapped into the process that receives this message.
[email protected]8bd0de72011-04-08 18:52:10151IPC_MESSAGE_ROUTED4(ResourceMsg_DataReceived,
[email protected]94dc971d2011-03-05 19:08:32152 int /* request_id */,
153 base::SharedMemoryHandle /* data */,
[email protected]8bd0de72011-04-08 18:52:10154 int /* data_len */,
[email protected]dfd682172011-04-13 19:57:25155 int /* encoded_data_length */)
[email protected]94dc971d2011-03-05 19:08:32156
157// Sent when some data from a resource request has been downloaded to
158// file. This is only called in the 'download_to_file' case and replaces
159// ResourceMsg_DataReceived in the call sequence in that case.
160IPC_MESSAGE_ROUTED2(ResourceMsg_DataDownloaded,
161 int /* request_id */,
162 int /* data_len */)
163
164// Sent when the request has been completed.
165IPC_MESSAGE_ROUTED4(ResourceMsg_RequestComplete,
166 int /* request_id */,
167 net::URLRequestStatus /* status */,
168 std::string /* security info */,
169 base::Time /* completion_time */)
170
171// Resource messages sent from the renderer to the browser.
172
173// Makes a resource request via the browser.
174IPC_MESSAGE_ROUTED2(ResourceHostMsg_RequestResource,
175 int /* request_id */,
176 ResourceHostMsg_Request)
177
178// Cancels a resource request with the ID given as the parameter.
179IPC_MESSAGE_ROUTED1(ResourceHostMsg_CancelRequest,
180 int /* request_id */)
181
[email protected]b00ba702011-08-17 01:41:03182// Sets a new routing id for the resource request with the ID given as the
183// parameter. This happens when a pending request is transferred to another
184// page.
185IPC_MESSAGE_CONTROL2(ResourceHostMsg_TransferRequestToNewPage,
186 int /* new routing_id */,
187 int /* request_id */)
188
[email protected]94dc971d2011-03-05 19:08:32189// Follows a redirect that occured for the resource request with the ID given
190// as the parameter.
191IPC_MESSAGE_ROUTED3(ResourceHostMsg_FollowRedirect,
192 int /* request_id */,
193 bool /* has_new_first_party_for_cookies */,
194 GURL /* new_first_party_for_cookies */)
195
196// Makes a synchronous resource request via the browser.
197IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad,
198 int /* request_id */,
199 ResourceHostMsg_Request,
[email protected]2336ffe2011-11-24 01:23:34200 content::SyncLoadResult)
[email protected]94dc971d2011-03-05 19:08:32201
202// Sent when the renderer process is done processing a DataReceived
203// message.
204IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataReceived_ACK,
205 int /* request_id */)
206
207// Sent when the renderer has processed a DataDownloaded message.
208IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataDownloaded_ACK,
209 int /* request_id */)
210
211// Sent by the renderer process to acknowledge receipt of a
212// UploadProgress message.
213IPC_MESSAGE_ROUTED1(ResourceHostMsg_UploadProgress_ACK,
214 int /* request_id */)
215
216// Sent when the renderer process deletes a resource loader.
217IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile,
218 int /* request_id */)