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