| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // IPC messages for resource loading. | 5 // IPC messages for resource loading. |
| 6 // | 6 // |
| 7 // NOTE: All messages must send an |int request_id| as their first parameter. | 7 // NOTE: All messages must send an |int request_id| as their first parameter. |
| 8 | 8 |
| 9 // Multiply-included message file, hence no include guard. | 9 // Multiply-included message file, hence no include guard. |
| 10 | 10 |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/process/process.h" | 14 #include "base/process/process.h" |
| 15 #include "content/common/content_param_traits_macros.h" | 15 #include "content/common/content_param_traits_macros.h" |
| 16 #include "content/common/navigation_params.h" | 16 #include "content/common/navigation_params.h" |
| 17 #include "content/common/resource_request.h" |
| 17 #include "content/common/resource_request_body.h" | 18 #include "content/common/resource_request_body.h" |
| 19 #include "content/common/resource_request_completion_status.h" |
| 18 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
| 19 #include "content/public/common/common_param_traits.h" | 21 #include "content/public/common/common_param_traits.h" |
| 20 #include "content/public/common/resource_response.h" | 22 #include "content/public/common/resource_response.h" |
| 21 #include "ipc/ipc_message_macros.h" | 23 #include "ipc/ipc_message_macros.h" |
| 22 #include "net/base/request_priority.h" | 24 #include "net/base/request_priority.h" |
| 23 #include "net/cert/signed_certificate_timestamp.h" | 25 #include "net/cert/signed_certificate_timestamp.h" |
| 24 #include "net/http/http_response_info.h" | 26 #include "net/http/http_response_info.h" |
| 25 #include "net/nqe/network_quality_estimator.h" | 27 #include "net/nqe/network_quality_estimator.h" |
| 26 #include "net/ssl/signed_certificate_timestamp_and_status.h" | 28 #include "net/ssl/signed_certificate_timestamp_and_status.h" |
| 27 #include "net/url_request/redirect_info.h" | 29 #include "net/url_request/redirect_info.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 IPC_STRUCT_TRAITS_MEMBER(referred_token_binding_host) | 191 IPC_STRUCT_TRAITS_MEMBER(referred_token_binding_host) |
| 190 IPC_STRUCT_TRAITS_END() | 192 IPC_STRUCT_TRAITS_END() |
| 191 | 193 |
| 192 IPC_STRUCT_TRAITS_BEGIN(net::SignedCertificateTimestampAndStatus) | 194 IPC_STRUCT_TRAITS_BEGIN(net::SignedCertificateTimestampAndStatus) |
| 193 IPC_STRUCT_TRAITS_MEMBER(sct) | 195 IPC_STRUCT_TRAITS_MEMBER(sct) |
| 194 IPC_STRUCT_TRAITS_MEMBER(status) | 196 IPC_STRUCT_TRAITS_MEMBER(status) |
| 195 IPC_STRUCT_TRAITS_END() | 197 IPC_STRUCT_TRAITS_END() |
| 196 | 198 |
| 197 IPC_ENUM_TRAITS_MAX_VALUE(net::ct::SCTVerifyStatus, net::ct::SCT_STATUS_MAX) | 199 IPC_ENUM_TRAITS_MAX_VALUE(net::ct::SCTVerifyStatus, net::ct::SCT_STATUS_MAX) |
| 198 | 200 |
| 199 // Parameters for a resource request. | 201 IPC_STRUCT_TRAITS_BEGIN(content::ResourceRequest) |
| 200 IPC_STRUCT_BEGIN(ResourceHostMsg_Request) | 202 IPC_STRUCT_TRAITS_MEMBER(method) |
| 201 // The request method: GET, POST, etc. | 203 IPC_STRUCT_TRAITS_MEMBER(url) |
| 202 IPC_STRUCT_MEMBER(std::string, method) | 204 IPC_STRUCT_TRAITS_MEMBER(first_party_for_cookies) |
| 203 | 205 IPC_STRUCT_TRAITS_MEMBER(request_initiator) |
| 204 // The requested URL. | 206 IPC_STRUCT_TRAITS_MEMBER(referrer) |
| 205 IPC_STRUCT_MEMBER(GURL, url) | 207 IPC_STRUCT_TRAITS_MEMBER(referrer_policy) |
| 206 | 208 IPC_STRUCT_TRAITS_MEMBER(visiblity_state) |
| 207 // Usually the URL of the document in the top-level window, which may be | 209 IPC_STRUCT_TRAITS_MEMBER(headers) |
| 208 // checked by the third-party cookie blocking policy. Leaving it empty may | 210 IPC_STRUCT_TRAITS_MEMBER(load_flags) |
| 209 // lead to undesired cookie blocking. Third-party cookie blocking can be | 211 IPC_STRUCT_TRAITS_MEMBER(origin_pid) |
| 210 // bypassed by setting first_party_for_cookies = url, but this should ideally | 212 IPC_STRUCT_TRAITS_MEMBER(resource_type) |
| 211 // only be done if there really is no way to determine the correct value. | 213 IPC_STRUCT_TRAITS_MEMBER(priority) |
| 212 IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) | 214 IPC_STRUCT_TRAITS_MEMBER(request_context) |
| 213 | 215 IPC_STRUCT_TRAITS_MEMBER(appcache_host_id) |
| 214 // The origin of the context which initiated the request, which will be used | 216 IPC_STRUCT_TRAITS_MEMBER(should_reset_appcache) |
| 215 // for cookie checks like 'First-Party-Only'. | 217 IPC_STRUCT_TRAITS_MEMBER(service_worker_provider_id) |
| 216 IPC_STRUCT_MEMBER(url::Origin, request_initiator) | 218 IPC_STRUCT_TRAITS_MEMBER(originated_from_service_worker) |
| 217 | 219 IPC_STRUCT_TRAITS_MEMBER(skip_service_worker) |
| 218 // The referrer to use (may be empty). | 220 IPC_STRUCT_TRAITS_MEMBER(fetch_request_mode) |
| 219 IPC_STRUCT_MEMBER(GURL, referrer) | 221 IPC_STRUCT_TRAITS_MEMBER(fetch_credentials_mode) |
| 220 | 222 IPC_STRUCT_TRAITS_MEMBER(fetch_redirect_mode) |
| 221 // The referrer policy to use. | 223 IPC_STRUCT_TRAITS_MEMBER(fetch_request_context_type) |
| 222 IPC_STRUCT_MEMBER(blink::WebReferrerPolicy, referrer_policy) | 224 IPC_STRUCT_TRAITS_MEMBER(fetch_frame_type) |
| 223 | 225 IPC_STRUCT_TRAITS_MEMBER(request_body) |
| 224 // The frame's visiblity state. | 226 IPC_STRUCT_TRAITS_MEMBER(download_to_file) |
| 225 IPC_STRUCT_MEMBER(blink::WebPageVisibilityState, visiblity_state) | 227 IPC_STRUCT_TRAITS_MEMBER(has_user_gesture) |
| 226 | 228 IPC_STRUCT_TRAITS_MEMBER(enable_load_timing) |
| 227 // Additional HTTP request headers. | 229 IPC_STRUCT_TRAITS_MEMBER(enable_upload_progress) |
| 228 IPC_STRUCT_MEMBER(std::string, headers) | 230 IPC_STRUCT_TRAITS_MEMBER(do_not_prompt_for_login) |
| 229 | 231 IPC_STRUCT_TRAITS_MEMBER(render_frame_id) |
| 230 // net::URLRequest load flags (0 by default). | 232 IPC_STRUCT_TRAITS_MEMBER(is_main_frame) |
| 231 IPC_STRUCT_MEMBER(int, load_flags) | 233 IPC_STRUCT_TRAITS_MEMBER(parent_is_main_frame) |
| 232 | 234 IPC_STRUCT_TRAITS_MEMBER(parent_render_frame_id) |
| 233 // Process ID from which this request originated, or zero if it originated | 235 IPC_STRUCT_TRAITS_MEMBER(transition_type) |
| 234 // in the renderer itself. | 236 IPC_STRUCT_TRAITS_MEMBER(should_replace_current_entry) |
| 235 // If kDirectNPAPIRequests isn't specified, then plugin requests get routed | 237 IPC_STRUCT_TRAITS_MEMBER(transferred_request_child_id) |
| 236 // through the renderer and and this holds the pid of the plugin process. | 238 IPC_STRUCT_TRAITS_MEMBER(transferred_request_request_id) |
| 237 // Otherwise this holds the render_process_id of the view that has the plugin. | 239 IPC_STRUCT_TRAITS_MEMBER(allow_download) |
| 238 IPC_STRUCT_MEMBER(int, origin_pid) | 240 IPC_STRUCT_TRAITS_MEMBER(report_raw_headers) |
| 239 | 241 IPC_STRUCT_TRAITS_MEMBER(lofi_state) |
| 240 // What this resource load is for (main frame, sub-frame, sub-resource, | 242 IPC_STRUCT_TRAITS_MEMBER(resource_body_stream_url) |
| 241 // object). | 243 IPC_STRUCT_TRAITS_END() |
| 242 IPC_STRUCT_MEMBER(content::ResourceType, resource_type) | |
| 243 | |
| 244 // The priority of this request. | |
| 245 IPC_STRUCT_MEMBER(net::RequestPriority, priority) | |
| 246 | |
| 247 // Used by plugin->browser requests to get the correct net::URLRequestContext. | |
| 248 IPC_STRUCT_MEMBER(uint32_t, request_context) | |
| 249 | |
| 250 // Indicates which frame (or worker context) the request is being loaded into, | |
| 251 // or kAppCacheNoHostId. | |
| 252 IPC_STRUCT_MEMBER(int, appcache_host_id) | |
| 253 | |
| 254 // True if corresponding AppCache group should be resetted. | |
| 255 IPC_STRUCT_MEMBER(bool, should_reset_appcache) | |
| 256 | |
| 257 // Indicates which frame (or worker context) the request is being loaded into, | |
| 258 // or kInvalidServiceWorkerProviderId. | |
| 259 IPC_STRUCT_MEMBER(int, service_worker_provider_id) | |
| 260 | |
| 261 // True if the request originated from a Service Worker, e.g. due to a | |
| 262 // fetch() in the Service Worker script. | |
| 263 IPC_STRUCT_MEMBER(bool, originated_from_service_worker) | |
| 264 | |
| 265 // True if the request should not be handled by the ServiceWorker. | |
| 266 IPC_STRUCT_MEMBER(bool, skip_service_worker) | |
| 267 | |
| 268 // The request mode passed to the ServiceWorker. | |
| 269 IPC_STRUCT_MEMBER(content::FetchRequestMode, fetch_request_mode) | |
| 270 | |
| 271 // The credentials mode passed to the ServiceWorker. | |
| 272 IPC_STRUCT_MEMBER(content::FetchCredentialsMode, fetch_credentials_mode) | |
| 273 | |
| 274 // The redirect mode used in Fetch API. | |
| 275 IPC_STRUCT_MEMBER(content::FetchRedirectMode, fetch_redirect_mode) | |
| 276 | |
| 277 // The request context passed to the ServiceWorker. | |
| 278 IPC_STRUCT_MEMBER(content::RequestContextType, fetch_request_context_type) | |
| 279 | |
| 280 // The frame type passed to the ServiceWorker. | |
| 281 IPC_STRUCT_MEMBER(content::RequestContextFrameType, fetch_frame_type) | |
| 282 | |
| 283 // Optional resource request body (may be null). | |
| 284 IPC_STRUCT_MEMBER(scoped_refptr<content::ResourceRequestBody>, | |
| 285 request_body) | |
| 286 | |
| 287 IPC_STRUCT_MEMBER(bool, download_to_file) | |
| 288 | |
| 289 // True if the request was user initiated. | |
| 290 IPC_STRUCT_MEMBER(bool, has_user_gesture) | |
| 291 | |
| 292 // True if load timing data should be collected for request. | |
| 293 IPC_STRUCT_MEMBER(bool, enable_load_timing) | |
| 294 | |
| 295 // True if upload progress should be available for request. | |
| 296 IPC_STRUCT_MEMBER(bool, enable_upload_progress) | |
| 297 | |
| 298 // True if login prompts for this request should be supressed. | |
| 299 IPC_STRUCT_MEMBER(bool, do_not_prompt_for_login) | |
| 300 | |
| 301 // The routing id of the RenderFrame. | |
| 302 IPC_STRUCT_MEMBER(int, render_frame_id) | |
| 303 | |
| 304 // True if |frame_id| is the main frame of a RenderView. | |
| 305 IPC_STRUCT_MEMBER(bool, is_main_frame) | |
| 306 | |
| 307 // True if |parent_render_frame_id| is the main frame of a RenderView. | |
| 308 IPC_STRUCT_MEMBER(bool, parent_is_main_frame) | |
| 309 | |
| 310 // Identifies the parent frame of the frame that sent the request. | |
| 311 // -1 if unknown / invalid. | |
| 312 IPC_STRUCT_MEMBER(int, parent_render_frame_id) | |
| 313 | |
| 314 IPC_STRUCT_MEMBER(ui::PageTransition, transition_type) | |
| 315 | |
| 316 // For navigations, whether this navigation should replace the current session | |
| 317 // history entry on commit. | |
| 318 IPC_STRUCT_MEMBER(bool, should_replace_current_entry) | |
| 319 | |
| 320 // The following two members identify a previous request that has been | |
| 321 // created before this navigation has been transferred to a new render view. | |
| 322 // This serves the purpose of recycling the old request. | |
| 323 // Unless this refers to a transferred navigation, these values are -1 and -1. | |
| 324 IPC_STRUCT_MEMBER(int, transferred_request_child_id) | |
| 325 IPC_STRUCT_MEMBER(int, transferred_request_request_id) | |
| 326 | |
| 327 // Whether or not we should allow the URL to download. | |
| 328 IPC_STRUCT_MEMBER(bool, allow_download) | |
| 329 | |
| 330 // Whether to intercept headers to pass back to the renderer. | |
| 331 IPC_STRUCT_MEMBER(bool, report_raw_headers) | |
| 332 | |
| 333 // Whether or not to request a LoFi version of the resource or let the browser | |
| 334 // decide. | |
| 335 IPC_STRUCT_MEMBER(content::LoFiState, lofi_state) | |
| 336 | |
| 337 // PlzNavigate: the stream url associated with a navigation. Used to get | |
| 338 // access to the body of the response that has already been fetched by the | |
| 339 // browser. | |
| 340 IPC_STRUCT_MEMBER(GURL, resource_body_stream_url) | |
| 341 IPC_STRUCT_END() | |
| 342 | 244 |
| 343 // Parameters for a ResourceMsg_RequestComplete | 245 // Parameters for a ResourceMsg_RequestComplete |
| 344 IPC_STRUCT_BEGIN(ResourceMsg_RequestCompleteData) | 246 IPC_STRUCT_TRAITS_BEGIN(content::ResourceRequestCompletionStatus) |
| 345 // The error code. | 247 IPC_STRUCT_TRAITS_MEMBER(error_code) |
| 346 IPC_STRUCT_MEMBER(int, error_code) | 248 IPC_STRUCT_TRAITS_MEMBER(was_ignored_by_handler) |
| 347 | 249 IPC_STRUCT_TRAITS_MEMBER(exists_in_cache) |
| 348 // Was ignored by the request handler. | 250 IPC_STRUCT_TRAITS_MEMBER(security_info) |
| 349 IPC_STRUCT_MEMBER(bool, was_ignored_by_handler) | 251 IPC_STRUCT_TRAITS_MEMBER(completion_time) |
| 350 | 252 IPC_STRUCT_TRAITS_MEMBER(encoded_data_length) |
| 351 // A copy of the data requested exists in the cache. | 253 IPC_STRUCT_TRAITS_END() |
| 352 IPC_STRUCT_MEMBER(bool, exists_in_cache) | |
| 353 | |
| 354 // Serialized security info; see content/common/ssl_status_serialization.h. | |
| 355 IPC_STRUCT_MEMBER(std::string, security_info) | |
| 356 | |
| 357 // Time the request completed. | |
| 358 IPC_STRUCT_MEMBER(base::TimeTicks, completion_time) | |
| 359 | |
| 360 // Total amount of data received from the network. | |
| 361 IPC_STRUCT_MEMBER(int64_t, encoded_data_length) | |
| 362 IPC_STRUCT_END() | |
| 363 | 254 |
| 364 // Resource messages sent from the browser to the renderer. | 255 // Resource messages sent from the browser to the renderer. |
| 365 | 256 |
| 366 // Sent when the headers are available for a resource request. | 257 // Sent when the headers are available for a resource request. |
| 367 IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedResponse, | 258 IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedResponse, |
| 368 int /* request_id */, | 259 int /* request_id */, |
| 369 content::ResourceResponseHead) | 260 content::ResourceResponseHead) |
| 370 | 261 |
| 371 // Sent when cached metadata from a resource request is ready. | 262 // Sent when cached metadata from a resource request is ready. |
| 372 IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedCachedMetadata, | 263 IPC_MESSAGE_CONTROL2(ResourceMsg_ReceivedCachedMetadata, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // file. This is only called in the 'download_to_file' case and replaces | 316 // file. This is only called in the 'download_to_file' case and replaces |
| 426 // ResourceMsg_DataReceived in the call sequence in that case. | 317 // ResourceMsg_DataReceived in the call sequence in that case. |
| 427 IPC_MESSAGE_CONTROL3(ResourceMsg_DataDownloaded, | 318 IPC_MESSAGE_CONTROL3(ResourceMsg_DataDownloaded, |
| 428 int /* request_id */, | 319 int /* request_id */, |
| 429 int /* data_len */, | 320 int /* data_len */, |
| 430 int /* encoded_data_length */) | 321 int /* encoded_data_length */) |
| 431 | 322 |
| 432 // Sent when the request has been completed. | 323 // Sent when the request has been completed. |
| 433 IPC_MESSAGE_CONTROL2(ResourceMsg_RequestComplete, | 324 IPC_MESSAGE_CONTROL2(ResourceMsg_RequestComplete, |
| 434 int /* request_id */, | 325 int /* request_id */, |
| 435 ResourceMsg_RequestCompleteData) | 326 content::ResourceRequestCompletionStatus) |
| 436 | 327 |
| 437 // Resource messages sent from the renderer to the browser. | 328 // Resource messages sent from the renderer to the browser. |
| 438 | 329 |
| 439 // Makes a resource request via the browser. | 330 // Makes a resource request via the browser. |
| 440 IPC_MESSAGE_CONTROL3(ResourceHostMsg_RequestResource, | 331 IPC_MESSAGE_CONTROL3(ResourceHostMsg_RequestResource, |
| 441 int /* routing_id */, | 332 int /* routing_id */, |
| 442 int /* request_id */, | 333 int /* request_id */, |
| 443 ResourceHostMsg_Request) | 334 content::ResourceRequest) |
| 444 | 335 |
| 445 // Cancels a resource request with the ID given as the parameter. | 336 // Cancels a resource request with the ID given as the parameter. |
| 446 IPC_MESSAGE_CONTROL1(ResourceHostMsg_CancelRequest, | 337 IPC_MESSAGE_CONTROL1(ResourceHostMsg_CancelRequest, |
| 447 int /* request_id */) | 338 int /* request_id */) |
| 448 | 339 |
| 449 // Follows a redirect that occured for the resource request with the ID given | 340 // Follows a redirect that occured for the resource request with the ID given |
| 450 // as the parameter. | 341 // as the parameter. |
| 451 IPC_MESSAGE_CONTROL1(ResourceHostMsg_FollowRedirect, | 342 IPC_MESSAGE_CONTROL1(ResourceHostMsg_FollowRedirect, |
| 452 int /* request_id */) | 343 int /* request_id */) |
| 453 | 344 |
| 454 // Makes a synchronous resource request via the browser. | 345 // Makes a synchronous resource request via the browser. |
| 455 IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, | 346 IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, |
| 456 int /* request_id */, | 347 int /* request_id */, |
| 457 ResourceHostMsg_Request, | 348 content::ResourceRequest, |
| 458 content::SyncLoadResult) | 349 content::SyncLoadResult) |
| 459 | 350 |
| 460 // Sent when the renderer process is done processing a DataReceived | 351 // Sent when the renderer process is done processing a DataReceived |
| 461 // message. | 352 // message. |
| 462 IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataReceived_ACK, | 353 IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataReceived_ACK, |
| 463 int /* request_id */) | 354 int /* request_id */) |
| 464 | 355 |
| 465 // Sent when the renderer has processed a DataDownloaded message. | 356 // Sent when the renderer has processed a DataDownloaded message. |
| 466 IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataDownloaded_ACK, | 357 IPC_MESSAGE_CONTROL1(ResourceHostMsg_DataDownloaded_ACK, |
| 467 int /* request_id */) | 358 int /* request_id */) |
| 468 | 359 |
| 469 // Sent by the renderer process to acknowledge receipt of a | 360 // Sent by the renderer process to acknowledge receipt of a |
| 470 // UploadProgress message. | 361 // UploadProgress message. |
| 471 IPC_MESSAGE_CONTROL1(ResourceHostMsg_UploadProgress_ACK, | 362 IPC_MESSAGE_CONTROL1(ResourceHostMsg_UploadProgress_ACK, |
| 472 int /* request_id */) | 363 int /* request_id */) |
| 473 | 364 |
| 474 // Sent when the renderer process deletes a resource loader. | 365 // Sent when the renderer process deletes a resource loader. |
| 475 IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, | 366 IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, |
| 476 int /* request_id */) | 367 int /* request_id */) |
| 477 | 368 |
| 478 // Sent by the renderer when a resource request changes priority. | 369 // Sent by the renderer when a resource request changes priority. |
| 479 IPC_MESSAGE_CONTROL3(ResourceHostMsg_DidChangePriority, | 370 IPC_MESSAGE_CONTROL3(ResourceHostMsg_DidChangePriority, |
| 480 int /* request_id */, | 371 int /* request_id */, |
| 481 net::RequestPriority, | 372 net::RequestPriority, |
| 482 int /* intra_priority_value */) | 373 int /* intra_priority_value */) |
| OLD | NEW |