diff options
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/common_param_traits.cc | 400 | ||||
-rw-r--r-- | content/common/common_param_traits.h | 73 | ||||
-rw-r--r-- | content/common/content_message_generator.h | 1 | ||||
-rw-r--r-- | content/common/resource_messages.h | 196 | ||||
-rw-r--r-- | content/common/resource_response.h | 41 |
5 files changed, 711 insertions, 0 deletions
diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc index d25cb5b..fe92765 100644 --- a/content/common/common_param_traits.cc +++ b/content/common/common_param_traits.cc @@ -5,6 +5,10 @@ #include "content/common/common_param_traits.h" #include "content/common/content_constants.h" +#include "net/base/host_port_pair.h" +#include "net/base/upload_data.h" +#include "net/http/http_response_headers.h" +#include "webkit/glue/resource_loader_bridge.h" namespace IPC { @@ -27,4 +31,400 @@ void ParamTraits<GURL>::Log(const GURL& p, std::string* l) { l->append(p.spec()); } + +void ParamTraits<ResourceType::Type>::Write(Message* m, const param_type& p) { + m->WriteInt(p); +} + +bool ParamTraits<ResourceType::Type>::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) + return false; + *p = ResourceType::FromInt(type); + return true; +} + +void ParamTraits<ResourceType::Type>::Log(const param_type& p, std::string* l) { + std::string type; + switch (p) { + case ResourceType::MAIN_FRAME: + type = "MAIN_FRAME"; + break; + case ResourceType::SUB_FRAME: + type = "SUB_FRAME"; + break; + case ResourceType::SUB_RESOURCE: + type = "SUB_RESOURCE"; + break; + case ResourceType::OBJECT: + type = "OBJECT"; + break; + case ResourceType::MEDIA: + type = "MEDIA"; + break; + default: + type = "UNKNOWN"; + break; + } + + LogParam(type, l); +} + +void ParamTraits<net::URLRequestStatus>::Write(Message* m, + const param_type& p) { + WriteParam(m, static_cast<int>(p.status())); + WriteParam(m, p.os_error()); +} + +bool ParamTraits<net::URLRequestStatus>::Read(const Message* m, void** iter, + param_type* r) { + int status, os_error; + if (!ReadParam(m, iter, &status) || + !ReadParam(m, iter, &os_error)) + return false; + r->set_status(static_cast<net::URLRequestStatus::Status>(status)); + r->set_os_error(os_error); + return true; +} + +void ParamTraits<net::URLRequestStatus>::Log(const param_type& p, + std::string* l) { + std::string status; + switch (p.status()) { + case net::URLRequestStatus::SUCCESS: + status = "SUCCESS"; + break; + case net::URLRequestStatus::IO_PENDING: + status = "IO_PENDING "; + break; + case net::URLRequestStatus::HANDLED_EXTERNALLY: + status = "HANDLED_EXTERNALLY"; + break; + case net::URLRequestStatus::CANCELED: + status = "CANCELED"; + break; + case net::URLRequestStatus::FAILED: + status = "FAILED"; + break; + default: + status = "UNKNOWN"; + break; + } + if (p.status() == net::URLRequestStatus::FAILED) + l->append("("); + + LogParam(status, l); + + if (p.status() == net::URLRequestStatus::FAILED) { + l->append(", "); + LogParam(p.os_error(), l); + l->append(")"); + } +} + +// Only the net::UploadData ParamTraits<> definition needs this definition, so +// keep this in the implementation file so we can forward declare UploadData in +// the header. +template <> +struct ParamTraits<net::UploadData::Element> { + typedef net::UploadData::Element param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, static_cast<int>(p.type())); + switch (p.type()) { + case net::UploadData::TYPE_BYTES: { + m->WriteData(&p.bytes()[0], static_cast<int>(p.bytes().size())); + break; + } + case net::UploadData::TYPE_CHUNK: { + std::string chunk_length = StringPrintf( + "%X\r\n", static_cast<unsigned int>(p.bytes().size())); + std::vector<char> bytes; + bytes.insert(bytes.end(), chunk_length.data(), + chunk_length.data() + chunk_length.length()); + const char* data = &p.bytes()[0]; + bytes.insert(bytes.end(), data, data + p.bytes().size()); + const char* crlf = "\r\n"; + bytes.insert(bytes.end(), crlf, crlf + strlen(crlf)); + if (p.is_last_chunk()) { + const char* end_of_data = "0\r\n\r\n"; + bytes.insert(bytes.end(), end_of_data, + end_of_data + strlen(end_of_data)); + } + m->WriteData(&bytes[0], static_cast<int>(bytes.size())); + // If this element is part of a chunk upload then send over information + // indicating if this is the last chunk. + WriteParam(m, p.is_last_chunk()); + break; + } + case net::UploadData::TYPE_FILE: { + WriteParam(m, p.file_path()); + WriteParam(m, p.file_range_offset()); + WriteParam(m, p.file_range_length()); + WriteParam(m, p.expected_file_modification_time()); + break; + } + default: { + WriteParam(m, p.blob_url()); + break; + } + } + } + static bool Read(const Message* m, void** iter, param_type* r) { + int type; + if (!ReadParam(m, iter, &type)) + return false; + switch (type) { + case net::UploadData::TYPE_BYTES: { + const char* data; + int len; + if (!m->ReadData(iter, &data, &len)) + return false; + r->SetToBytes(data, len); + break; + } + case net::UploadData::TYPE_CHUNK: { + const char* data; + int len; + if (!m->ReadData(iter, &data, &len)) + return false; + r->SetToBytes(data, len); + // If this element is part of a chunk upload then we need to explicitly + // set the type of the element and whether it is the last chunk. + bool is_last_chunk = false; + if (!ReadParam(m, iter, &is_last_chunk)) + return false; + r->set_type(net::UploadData::TYPE_CHUNK); + r->set_is_last_chunk(is_last_chunk); + break; + } + case net::UploadData::TYPE_FILE: { + FilePath file_path; + uint64 offset, length; + base::Time expected_modification_time; + if (!ReadParam(m, iter, &file_path)) + return false; + if (!ReadParam(m, iter, &offset)) + return false; + if (!ReadParam(m, iter, &length)) + return false; + if (!ReadParam(m, iter, &expected_modification_time)) + return false; + r->SetToFilePathRange(file_path, offset, length, + expected_modification_time); + break; + } + default: { + DCHECK(type == net::UploadData::TYPE_BLOB); + GURL blob_url; + if (!ReadParam(m, iter, &blob_url)) + return false; + r->SetToBlobUrl(blob_url); + break; + } + } + return true; + } + static void Log(const param_type& p, std::string* l) { + l->append("<net::UploadData::Element>"); + } +}; + +void ParamTraits<scoped_refptr<net::UploadData> >::Write(Message* m, + const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p) { + WriteParam(m, *p->elements()); + WriteParam(m, p->identifier()); + WriteParam(m, p->is_chunked()); + } +} + +bool ParamTraits<scoped_refptr<net::UploadData> >::Read(const Message* m, + void** iter, + param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (!has_object) + return true; + std::vector<net::UploadData::Element> elements; + if (!ReadParam(m, iter, &elements)) + return false; + int64 identifier; + if (!ReadParam(m, iter, &identifier)) + return false; + bool is_chunked = false; + if (!ReadParam(m, iter, &is_chunked)) + return false; + *r = new net::UploadData; + (*r)->swap_elements(&elements); + (*r)->set_identifier(identifier); + (*r)->set_is_chunked(is_chunked); + return true; +} + +void ParamTraits<scoped_refptr<net::UploadData> >::Log(const param_type& p, + std::string* l) { + l->append("<net::UploadData>"); +} + +void ParamTraits<net::HostPortPair>::Write(Message* m, const param_type& p) { + WriteParam(m, p.host()); + WriteParam(m, p.port()); +} + +bool ParamTraits<net::HostPortPair>::Read(const Message* m, void** iter, + param_type* r) { + std::string host; + uint16 port; + if (!ReadParam(m, iter, &host) || !ReadParam(m, iter, &port)) + return false; + + r->set_host(host); + r->set_port(port); + return true; +} + +void ParamTraits<net::HostPortPair>::Log(const param_type& p, std::string* l) { + l->append(p.ToString()); +} + +void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( + Message* m, const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p) { + // Do not disclose Set-Cookie headers over IPC. + p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); + } +} + +bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( + const Message* m, void** iter, param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (has_object) + *r = new net::HttpResponseHeaders(*m, iter); + return true; +} + +void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( + const param_type& p, std::string* l) { + l->append("<HttpResponseHeaders>"); +} + +void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.base_time.is_null()); + if (p.base_time.is_null()) + return; + WriteParam(m, p.base_time); + WriteParam(m, p.proxy_start); + WriteParam(m, p.proxy_end); + WriteParam(m, p.dns_start); + WriteParam(m, p.dns_end); + WriteParam(m, p.connect_start); + WriteParam(m, p.connect_end); + WriteParam(m, p.ssl_start); + WriteParam(m, p.ssl_end); + WriteParam(m, p.send_start); + WriteParam(m, p.send_end); + WriteParam(m, p.receive_headers_start); + WriteParam(m, p.receive_headers_end); +} + +bool ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Read( + const Message* m, void** iter, param_type* r) { + bool is_null; + if (!ReadParam(m, iter, &is_null)) + return false; + if (is_null) + return true; + + return + ReadParam(m, iter, &r->base_time) && + ReadParam(m, iter, &r->proxy_start) && + ReadParam(m, iter, &r->proxy_end) && + ReadParam(m, iter, &r->dns_start) && + ReadParam(m, iter, &r->dns_end) && + ReadParam(m, iter, &r->connect_start) && + ReadParam(m, iter, &r->connect_end) && + ReadParam(m, iter, &r->ssl_start) && + ReadParam(m, iter, &r->ssl_end) && + ReadParam(m, iter, &r->send_start) && + ReadParam(m, iter, &r->send_end) && + ReadParam(m, iter, &r->receive_headers_start) && + ReadParam(m, iter, &r->receive_headers_end); +} + +void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.base_time, l); + l->append(", "); + LogParam(p.proxy_start, l); + l->append(", "); + LogParam(p.proxy_end, l); + l->append(", "); + LogParam(p.dns_start, l); + l->append(", "); + LogParam(p.dns_end, l); + l->append(", "); + LogParam(p.connect_start, l); + l->append(", "); + LogParam(p.connect_end, l); + l->append(", "); + LogParam(p.ssl_start, l); + l->append(", "); + LogParam(p.ssl_end, l); + l->append(", "); + LogParam(p.send_start, l); + l->append(", "); + LogParam(p.send_end, l); + l->append(", "); + LogParam(p.receive_headers_start, l); + l->append(", "); + LogParam(p.receive_headers_end, l); + l->append(")"); +} + +void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Write( + Message* m, const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p.get()) { + WriteParam(m, p->http_status_code); + WriteParam(m, p->http_status_text); + WriteParam(m, p->request_headers); + WriteParam(m, p->response_headers); + } +} + +bool ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Read( + const Message* m, void** iter, param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (!has_object) + return true; + *r = new webkit_glue::ResourceDevToolsInfo(); + return + ReadParam(m, iter, &(*r)->http_status_code) && + ReadParam(m, iter, &(*r)->http_status_text) && + ReadParam(m, iter, &(*r)->request_headers) && + ReadParam(m, iter, &(*r)->response_headers); +} + +void ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> >::Log( + const param_type& p, std::string* l) { + l->append("("); + if (p) { + LogParam(p->request_headers, l); + l->append(", "); + LogParam(p->response_headers, l); + } + l->append(")"); +} + } // namespace IPC diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index 9717dcc..1ecb5bb 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -14,17 +14,34 @@ #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ #pragma once +#include "base/ref_counted.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_utils.h" +#include "net/url_request/url_request_status.h" // !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! // // That means don't add #includes to any file in 'webkit/' or // 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and // content/common/ for a mini-library that doesn't depend on webkit. +// TODO(erg): The following headers are historical and only work because +// their definitions are inlined, which also needs to be fixed. +#include "webkit/glue/resource_type.h" + // Forward declarations. class GURL; +namespace net { +class HttpResponseHeaders; +class HostPortPair; +class UploadData; +} + +namespace webkit_glue { +struct ResourceDevToolsInfo; +struct ResourceLoadTimingInfo; +} + namespace IPC { template <> @@ -35,6 +52,62 @@ struct ParamTraits<GURL> { static void Log(const param_type& p, std::string* l); }; +template <> +struct ParamTraits<ResourceType::Type> { + typedef ResourceType::Type param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<net::URLRequestStatus> { + typedef net::URLRequestStatus param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<scoped_refptr<net::UploadData> > { + typedef scoped_refptr<net::UploadData> param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template<> +struct ParamTraits<net::HostPortPair> { + typedef net::HostPortPair param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { + typedef scoped_refptr<net::HttpResponseHeaders> param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<webkit_glue::ResourceLoadTimingInfo> { + typedef webkit_glue::ResourceLoadTimingInfo param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<scoped_refptr<webkit_glue::ResourceDevToolsInfo> > { + typedef scoped_refptr<webkit_glue::ResourceDevToolsInfo> param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + } // namespace IPC #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index bcda993..ac64b0d 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -5,4 +5,5 @@ // Multiply-included file, hence no include guard. #include "content/common/p2p_messages.h" +#include "content/common/resource_messages.h" #include "content/common/socket_stream_messages.h" diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h new file mode 100644 index 0000000..73b9f8a --- /dev/null +++ b/content/common/resource_messages.h @@ -0,0 +1,196 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// IPC messages for resource loading. +// Multiply-included message file, hence no include guard. + +#include "base/shared_memory.h" +#include "content/common/resource_response.h" +#include "ipc/ipc_message_macros.h" +#include "net/base/upload_data.h" + +namespace net { +class UploadData; +} + +#define IPC_MESSAGE_START ResourceMsgStart + +IPC_STRUCT_TRAITS_BEGIN(webkit_glue::ResourceResponseInfo) + IPC_STRUCT_TRAITS_MEMBER(request_time) + IPC_STRUCT_TRAITS_MEMBER(response_time) + IPC_STRUCT_TRAITS_MEMBER(headers) + IPC_STRUCT_TRAITS_MEMBER(mime_type) + IPC_STRUCT_TRAITS_MEMBER(charset) + IPC_STRUCT_TRAITS_MEMBER(security_info) + IPC_STRUCT_TRAITS_MEMBER(content_length) + IPC_STRUCT_TRAITS_MEMBER(appcache_id) + IPC_STRUCT_TRAITS_MEMBER(appcache_manifest_url) + IPC_STRUCT_TRAITS_MEMBER(connection_id) + IPC_STRUCT_TRAITS_MEMBER(connection_reused) + IPC_STRUCT_TRAITS_MEMBER(load_timing) + IPC_STRUCT_TRAITS_MEMBER(devtools_info) + IPC_STRUCT_TRAITS_MEMBER(download_file_path) + IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_spdy) + IPC_STRUCT_TRAITS_MEMBER(was_npn_negotiated) + IPC_STRUCT_TRAITS_MEMBER(was_alternate_protocol_available) + IPC_STRUCT_TRAITS_MEMBER(was_fetched_via_proxy) + IPC_STRUCT_TRAITS_MEMBER(socket_address) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(ResourceResponseHead) + IPC_STRUCT_TRAITS_PARENT(webkit_glue::ResourceResponseInfo) + IPC_STRUCT_TRAITS_MEMBER(status) +IPC_STRUCT_TRAITS_END() + +IPC_STRUCT_TRAITS_BEGIN(SyncLoadResult) + IPC_STRUCT_TRAITS_PARENT(ResourceResponseHead) + IPC_STRUCT_TRAITS_MEMBER(final_url) + IPC_STRUCT_TRAITS_MEMBER(data) +IPC_STRUCT_TRAITS_END() + +// Parameters for a resource request. +IPC_STRUCT_BEGIN(ResourceHostMsg_Request) + // The request method: GET, POST, etc. + IPC_STRUCT_MEMBER(std::string, method) + + // The requested URL. + IPC_STRUCT_MEMBER(GURL, url) + + // Usually the URL of the document in the top-level window, which may be + // checked by the third-party cookie blocking policy. Leaving it empty may + // lead to undesired cookie blocking. Third-party cookie blocking can be + // bypassed by setting first_party_for_cookies = url, but this should ideally + // only be done if there really is no way to determine the correct value. + IPC_STRUCT_MEMBER(GURL, first_party_for_cookies) + + // The referrer to use (may be empty). + IPC_STRUCT_MEMBER(GURL, referrer) + + // Additional HTTP request headers. + IPC_STRUCT_MEMBER(std::string, headers) + + // net::URLRequest load flags (0 by default). + IPC_STRUCT_MEMBER(int, load_flags) + + // Process ID from which this request originated, or zero if it originated + // in the renderer itself. + IPC_STRUCT_MEMBER(int, origin_pid) + + // What this resource load is for (main frame, sub-frame, sub-resource, + // object). + IPC_STRUCT_MEMBER(ResourceType::Type, resource_type) + + // Used by plugin->browser requests to get the correct net::URLRequestContext. + IPC_STRUCT_MEMBER(uint32, request_context) + + // Indicates which frame (or worker context) the request is being loaded into, + // or kNoHostId. + IPC_STRUCT_MEMBER(int, appcache_host_id) + + // Optional upload data (may be null). + IPC_STRUCT_MEMBER(scoped_refptr<net::UploadData>, upload_data) + + IPC_STRUCT_MEMBER(bool, download_to_file) + + // True if the request was user initiated. + IPC_STRUCT_MEMBER(bool, has_user_gesture) + + // The following two members are specified if the request is initiated by + // a plugin like Gears. + + // Contains the id of the host renderer. + IPC_STRUCT_MEMBER(int, host_renderer_id) + + // Contains the id of the host render view. + IPC_STRUCT_MEMBER(int, host_render_view_id) +IPC_STRUCT_END() + +// Resource messages sent from the browser to the renderer. + +// Sent when the headers are available for a resource request. +IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedResponse, + int /* request_id */, + ResourceResponseHead) + +// Sent when cached metadata from a resource request is ready. +IPC_MESSAGE_ROUTED2(ResourceMsg_ReceivedCachedMetadata, + int /* request_id */, + std::vector<char> /* data */) + +// Sent as upload progress is being made. +IPC_MESSAGE_ROUTED3(ResourceMsg_UploadProgress, + int /* request_id */, + int64 /* position */, + int64 /* size */) + +// Sent when the request has been redirected. The receiver is expected to +// respond with either a FollowRedirect message (if the redirect is to be +// followed) or a CancelRequest message (if it should not be followed). +IPC_MESSAGE_ROUTED3(ResourceMsg_ReceivedRedirect, + int /* request_id */, + GURL /* new_url */, + ResourceResponseHead) + +// Sent when some data from a resource request is ready. The handle should +// already be mapped into the process that receives this message. +IPC_MESSAGE_ROUTED3(ResourceMsg_DataReceived, + int /* request_id */, + base::SharedMemoryHandle /* data */, + int /* data_len */) + +// Sent when some data from a resource request has been downloaded to +// file. This is only called in the 'download_to_file' case and replaces +// ResourceMsg_DataReceived in the call sequence in that case. +IPC_MESSAGE_ROUTED2(ResourceMsg_DataDownloaded, + int /* request_id */, + int /* data_len */) + +// Sent when the request has been completed. +IPC_MESSAGE_ROUTED4(ResourceMsg_RequestComplete, + int /* request_id */, + net::URLRequestStatus /* status */, + std::string /* security info */, + base::Time /* completion_time */) + +// Resource messages sent from the renderer to the browser. + +// Makes a resource request via the browser. +IPC_MESSAGE_ROUTED2(ResourceHostMsg_RequestResource, + int /* request_id */, + ResourceHostMsg_Request) + +// Cancels a resource request with the ID given as the parameter. +IPC_MESSAGE_ROUTED1(ResourceHostMsg_CancelRequest, + int /* request_id */) + +// Follows a redirect that occured for the resource request with the ID given +// as the parameter. +IPC_MESSAGE_ROUTED3(ResourceHostMsg_FollowRedirect, + int /* request_id */, + bool /* has_new_first_party_for_cookies */, + GURL /* new_first_party_for_cookies */) + +// Makes a synchronous resource request via the browser. +IPC_SYNC_MESSAGE_ROUTED2_1(ResourceHostMsg_SyncLoad, + int /* request_id */, + ResourceHostMsg_Request, + SyncLoadResult) + +// Sent when the renderer process is done processing a DataReceived +// message. +IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataReceived_ACK, + int /* request_id */) + +// Sent when the renderer has processed a DataDownloaded message. +IPC_MESSAGE_ROUTED1(ResourceHostMsg_DataDownloaded_ACK, + int /* request_id */) + +// Sent by the renderer process to acknowledge receipt of a +// UploadProgress message. +IPC_MESSAGE_ROUTED1(ResourceHostMsg_UploadProgress_ACK, + int /* request_id */) + +// Sent when the renderer process deletes a resource loader. +IPC_MESSAGE_CONTROL1(ResourceHostMsg_ReleaseDownloadedFile, + int /* request_id */) diff --git a/content/common/resource_response.h b/content/common/resource_response.h new file mode 100644 index 0000000..e58e106 --- /dev/null +++ b/content/common/resource_response.h @@ -0,0 +1,41 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// See http://dev.chromium.org/developers/design-documents/multi-process-resource-loading + +#ifndef CONTENT_COMMON_RESOURCE_RESPONSE_H_ +#define CONTENT_COMMON_RESOURCE_RESPONSE_H_ +#pragma once + +#include <string> + +#include "base/ref_counted.h" +#include "googleurl/src/gurl.h" +#include "net/url_request/url_request_status.h" +#include "webkit/glue/resource_loader_bridge.h" + +// Parameters for a resource response header. +struct ResourceResponseHead : webkit_glue::ResourceResponseInfo { + // The response status. + net::URLRequestStatus status; +}; + +// Parameters for a synchronous resource response. +struct SyncLoadResult : ResourceResponseHead { + // The final URL after any redirects. + GURL final_url; + + // The response data. + std::string data; +}; + +// Simple wrapper that refcounts ResourceResponseHead. +struct ResourceResponse : public base::RefCounted<ResourceResponse> { + ResourceResponseHead response_head; + + private: + friend class base::RefCounted<ResourceResponse>; +}; + +#endif // CONTENT_COMMON_RESOURCE_RESPONSE_H_ |