blob: 1771461d04a567debd0079ebd1d5bfe59316bb5f [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
[email protected]d5a50342011-12-05 21:56:5270 // The referrer policy to use.
71 IPC_STRUCT_MEMBER(WebKit::WebReferrerPolicy, referrer_policy)
72
[email protected]94dc971d2011-03-05 19:08:3273 // Additional HTTP request headers.
74 IPC_STRUCT_MEMBER(std::string, headers)
75
76 // net::URLRequest load flags (0 by default).
77 IPC_STRUCT_MEMBER(int, load_flags)
78
79 // Process ID from which this request originated, or zero if it originated
80 // in the renderer itself.
81 IPC_STRUCT_MEMBER(int, origin_pid)
82
83 // What this resource load is for (main frame, sub-frame, sub-resource,
84 // object).
85 IPC_STRUCT_MEMBER(ResourceType::Type, resource_type)
86
87 // Used by plugin->browser requests to get the correct net::URLRequestContext.
88 IPC_STRUCT_MEMBER(uint32, request_context)
89
90 // Indicates which frame (or worker context) the request is being loaded into,
91 // or kNoHostId.
92 IPC_STRUCT_MEMBER(int, appcache_host_id)
93
94 // Optional upload data (may be null).
95 IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data)
96
97 IPC_STRUCT_MEMBER(bool, download_to_file)
98
99 // True if the request was user initiated.
100 IPC_STRUCT_MEMBER(bool, has_user_gesture)
[email protected]418da612011-07-21 19:01:52101
102 // True if |frame_id| is the main frame of a RenderView.
103 IPC_STRUCT_MEMBER(bool, is_main_frame)
104
105 // Identifies the frame within the RenderView that sent the request.
106 // -1 if unknown / invalid.
107 IPC_STRUCT_MEMBER(int64, frame_id)
[email protected]d88bf0a2011-08-30 23:55:57108
[email protected]91043a8232011-11-04 16:41:19109 // True if |parent_frame_id| is the main frame of a RenderView.
110 IPC_STRUCT_MEMBER(bool, parent_is_main_frame)
111
112 // Identifies the parent frame of the frame that sent the request.
113 // -1 if unknown / invalid.
114 IPC_STRUCT_MEMBER(int64, parent_frame_id)
115
[email protected]2905f742011-10-13 03:51:58116 IPC_STRUCT_MEMBER(content::PageTransition, transition_type)
[email protected]4ad5d77d2011-12-03 02:00:48117
118 // The following two members identify a previous request that has been
119 // created before this navigation has been transferred to a new render view.
120 // This serves the purpose of recycling the old request.
121 // Unless this refers to a transferred navigation, these values are -1 and -1.
122 IPC_STRUCT_MEMBER(int, transferred_request_child_id)
123 IPC_STRUCT_MEMBER(int, transferred_request_request_id)
[email protected]94dc971d2011-03-05 19:08:32124IPC_STRUCT_END()
125
126// Resource messages sent from the browser to the renderer.
127
128// Sent when the headers are available for a resource request.
129IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedResponse,
130 int /* request_id */,
[email protected]2336ffe2011-11-24 01:23:34131 content::ResourceResponseHead)
[email protected]94dc971d2011-03-05 19:08:32132
133// Sent when cached metadata from a resource request is ready.
134IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedCachedMetadata,
135 int /* request_id */,
136 std::vector<char> /* data */)
137
138// Sent as upload progress is being made.
139IPC_MESSAGE_ROUTED3(ResourceMsg_UploadProgress,
140 int /* request_id */,
141 int64 /* position */,
142 int64 /* size */)
143
144// Sent when the request has been redirected. The receiver is expected to
145// respond with either a FollowRedirect message (if the redirect is to be
146// followed) or a CancelRequest message (if it should not be followed).
147IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect,
148 int /* request_id */,
149 GURL /* new_url */,
[email protected]2336ffe2011-11-24 01:23:34150 content::ResourceResponseHead)
[email protected]94dc971d2011-03-05 19:08:32151
152// Sent when some data from a resource request is ready. The handle should
153// already be mapped into the process that receives this message.
[email protected]8bd0de72011-04-08 18:52:10154IPC_MESSAGE_ROUTED4(ResourceMsg_DataReceived,
[email protected]94dc971d2011-03-05 19:08:32155 int /* request_id */,
156 base::SharedMemoryHandle /* data */,
[email protected]8bd0de72011-04-08 18:52:10157 int /* data_len */,
[email protected]dfd682172011-04-13 19:57:25158 int /* encoded_data_length */)
[email protected]94dc971d2011-03-05 19:08:32159
160// Sent when some data from a resource request has been downloaded to
161// file. This is only called in the 'download_to_file' case and replaces
162// ResourceMsg_DataReceived in the call sequence in that case.
163IPC_MESSAGE_ROUTED2(ResourceMsg_DataDownloaded,
164 int /* request_id */,
165 int /* data_len */)
166
167// Sent when the request has been completed.
168IPC_MESSAGE_ROUTED4(ResourceMsg_RequestComplete,
169 int /* request_id */,
170 net::URLRequestStatus /* status */,
171 std::string /* security info */,
[email protected]cb8a87422011-12-16 01:15:57172 base::TimeTicks /* completion_time */)
[email protected]94dc971d2011-03-05 19:08:32173
174// Resource messages sent from the renderer to the browser.
175
176// Makes a resource request via the browser.
177IPC_MESSAGE_ROUTED2(ResourceHostMsg_RequestResource,
178 int /* request_id */,
179 ResourceHostMsg_Request)
180
181// Cancels a resource request with the ID given as the parameter.
182IPC_MESSAGE_ROUTED1(ResourceHostMsg_CancelRequest,
183 int /* request_id */)
184
[email protected]b00ba702011-08-17 01:41:03185// Sets a new routing id for the resource request with the ID given as the
186// parameter. This happens when a pending request is transferred to another
187// page.
188IPC_MESSAGE_CONTROL2(ResourceHostMsg_TransferRequestToNewPage,
189 int /* new routing_id */,
190 int /* request_id */)
191
[email protected]94dc971d2011-03-05 19:08:32192// Follows a redirect that occured for the resource request with the ID given
193// as the parameter.
194IPC_MESSAGE_ROUTED3(ResourceHostMsg_FollowRedirect,
195 int /* request_id */,
196 bool /* has_new_first_party_for_cookies */,
197 GURL /* new_first_party_for_cookies */)
198
199// Makes a synchronous resource request via the browser.
200IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad,
201 int /* request_id */,
202 ResourceHostMsg_Request,
[email protected]2336ffe2011-11-24 01:23:34203 content::SyncLoadResult)
[email protected]94dc971d2011-03-05 19:08:32204
205// Sent when the renderer process is done processing a DataReceived
206// message.
207IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataReceived_ACK,
208 int /* request_id */)
209
210// Sent when the renderer has processed a DataDownloaded message.
211IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataDownloaded_ACK,
212 int /* request_id */)
213
214// Sent by the renderer process to acknowledge receipt of a
215// UploadProgress message.
216IPC_MESSAGE_ROUTED1(ResourceHostMsg_UploadProgress_ACK,
217 int /* request_id */)
218
219// Sent when the renderer process deletes a resource loader.
220IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile,
221 int /* request_id */)