diff options
-rw-r--r-- | chrome/chrome_common.gypi | 3 | ||||
-rw-r--r-- | chrome/common/render_messages.cc | 100 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 26 | ||||
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 2 | ||||
-rw-r--r-- | chrome/worker/worker_webkitclient_impl.cc | 2 | ||||
-rw-r--r-- | chrome_frame/renderer_glue.cc | 7 | ||||
-rw-r--r-- | content/browser/renderer_host/blob_message_filter.cc | 10 | ||||
-rw-r--r-- | content/common/common_param_traits.cc | 100 | ||||
-rw-r--r-- | content/common/common_param_traits.h | 10 | ||||
-rw-r--r-- | content/common/content_message_generator.h | 1 | ||||
-rw-r--r-- | content/common/webblob_messages.h | 28 | ||||
-rw-r--r-- | content/common/webblobregistry_impl.cc (renamed from chrome/common/webblobregistry_impl.cc) | 12 | ||||
-rw-r--r-- | content/common/webblobregistry_impl.h (renamed from chrome/common/webblobregistry_impl.h) | 0 | ||||
-rw-r--r-- | content/content_common.gypi | 4 | ||||
-rw-r--r-- | ipc/ipc_message_utils.h | 1 |
15 files changed, 164 insertions, 142 deletions
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 648a28c..e2b45b3 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -117,8 +117,6 @@ 'common/time_format.h', 'common/unix_domain_socket_posix.cc', 'common/unix_domain_socket_posix.h', - 'common/webblobregistry_impl.cc', - 'common/webblobregistry_impl.h', 'common/win_safe_util.cc', 'common/win_safe_util.h', ], @@ -169,7 +167,6 @@ '../third_party/zlib/zlib.gyp:zlib', '../third_party/npapi/npapi.gyp:npapi', '../webkit/support/webkit_support.gyp:appcache', - '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:glue', ], 'sources': [ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index f6ec771..851bf39 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -800,106 +800,6 @@ void ParamTraits<webkit_glue::WebAccessibility>::Log(const param_type& p, l->append(")"); } -// Only the webkit_blob::BlobData ParamTraits<> definition needs this -// definition, so keep this in the implementation file so we can forward declare -// BlobData in the header. -template <> -struct ParamTraits<webkit_blob::BlobData::Item> { - typedef webkit_blob::BlobData::Item param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int>(p.type())); - if (p.type() == webkit_blob::BlobData::TYPE_DATA) { - WriteParam(m, p.data()); - } else if (p.type() == webkit_blob::BlobData::TYPE_FILE) { - WriteParam(m, p.file_path()); - WriteParam(m, p.offset()); - WriteParam(m, p.length()); - WriteParam(m, p.expected_modification_time()); - } else { - WriteParam(m, p.blob_url()); - WriteParam(m, p.offset()); - WriteParam(m, p.length()); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - int type; - if (!ReadParam(m, iter, &type)) - return false; - if (type == webkit_blob::BlobData::TYPE_DATA) { - std::string data; - if (!ReadParam(m, iter, &data)) - return false; - r->SetToData(data); - } else if (type == webkit_blob::BlobData::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->SetToFile(file_path, offset, length, expected_modification_time); - } else { - DCHECK(type == webkit_blob::BlobData::TYPE_BLOB); - GURL blob_url; - uint64 offset, length; - if (!ReadParam(m, iter, &blob_url)) - return false; - if (!ReadParam(m, iter, &offset)) - return false; - if (!ReadParam(m, iter, &length)) - return false; - r->SetToBlob(blob_url, offset, length); - } - return true; - } - static void Log(const param_type& p, std::string* l) { - l->append("<BlobData::Item>"); - } -}; - -void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Write( - Message* m, const param_type& p) { - WriteParam(m, p.get() != NULL); - if (p) { - WriteParam(m, p->items()); - WriteParam(m, p->content_type()); - WriteParam(m, p->content_disposition()); - } -} - -bool ParamTraits<scoped_refptr<webkit_blob::BlobData> >::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<webkit_blob::BlobData::Item> items; - if (!ReadParam(m, iter, &items)) - return false; - std::string content_type; - if (!ReadParam(m, iter, &content_type)) - return false; - std::string content_disposition; - if (!ReadParam(m, iter, &content_disposition)) - return false; - *r = new webkit_blob::BlobData; - (*r)->swap_items(&items); - (*r)->set_content_type(content_type); - (*r)->set_content_disposition(content_disposition); - return true; -} - -void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Log( - const param_type& p, std::string* l) { - l->append("<webkit_blob::BlobData>"); -} - void ParamTraits<AudioBuffersState>::Write(Message* m, const param_type& p) { WriteParam(m, p.pending_bytes); WriteParam(m, p.hardware_delay_bytes); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index a2f6160..9c7b3d9 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -55,7 +55,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "ui/gfx/rect.h" #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status -#include "webkit/blob/blob_data.h" #include "webkit/glue/context_menu.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcookie.h" @@ -402,14 +401,6 @@ struct ParamTraits<webkit_glue::WebAccessibility> { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits<scoped_refptr<webkit_blob::BlobData> > { - typedef scoped_refptr<webkit_blob::BlobData> 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); -}; - // Traits for AudioBuffersState structure. template <> struct ParamTraits<AudioBuffersState> { @@ -2544,23 +2535,6 @@ IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StartUpdating, IPC_MESSAGE_CONTROL1(ViewHostMsg_DeviceOrientation_StopUpdating, int /* render_view_id */) -//--------------------------------------------------------------------------- -// Blob messages: - -// Registers a blob URL referring to the specified blob data. -IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrl, - GURL /* url */, - scoped_refptr<webkit_blob::BlobData> /* blob_data */) - -// Registers a blob URL referring to the blob data identified by the specified -// source URL. -IPC_MESSAGE_CONTROL2(ViewHostMsg_RegisterBlobUrlFrom, - GURL /* url */, - GURL /* src_url */) - -// Unregister a blob URL. -IPC_MESSAGE_CONTROL1(ViewHostMsg_UnregisterBlobUrl, GURL /* url */) - // Suggest results ----------------------------------------------------------- IPC_MESSAGE_ROUTED3(ViewHostMsg_SetSuggestions, diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 6d24871..240f6d8 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -11,7 +11,6 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" -#include "chrome/common/webblobregistry_impl.h" #include "chrome/common/webmessageportchannel_impl.h" #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/net/renderer_net_predictor.h" @@ -27,6 +26,7 @@ #include "content/common/file_system/webfilesystem_impl.h" #include "content/common/file_utilities_messages.h" #include "content/common/mime_registry_messages.h" +#include "content/common/webblobregistry_impl.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc index 14eca31..261d049 100644 --- a/chrome/worker/worker_webkitclient_impl.cc +++ b/chrome/worker/worker_webkitclient_impl.cc @@ -8,13 +8,13 @@ #include "base/utf_string_conversions.h" #include "chrome/common/render_messages.h" #include "chrome/common/render_messages_params.h" -#include "chrome/common/webblobregistry_impl.h" #include "chrome/common/webmessageportchannel_impl.h" #include "chrome/worker/worker_thread.h" #include "content/common/database_util.h" #include "content/common/file_system/webfilesystem_impl.h" #include "content/common/file_utilities_messages.h" #include "content/common/mime_registry_messages.h" +#include "content/common/webblobregistry_impl.h" #include "ipc/ipc_sync_message_filter.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" diff --git a/chrome_frame/renderer_glue.cc b/chrome_frame/renderer_glue.cc index 8980e97..bc2c201 100644 --- a/chrome_frame/renderer_glue.cc +++ b/chrome_frame/renderer_glue.cc @@ -6,6 +6,13 @@ namespace webkit_glue { +void AppendToLog(const char* filename, int line, const char* message) { +} + +bool IsPluginRunningInRendererProcess() { + return true; +} + // This function is called from BuildUserAgent so we have our own version // here instead of pulling in the whole renderer lib where this function // is implemented for Chrome. diff --git a/content/browser/renderer_host/blob_message_filter.cc b/content/browser/renderer_host/blob_message_filter.cc index b04cfdb..829c025 100644 --- a/content/browser/renderer_host/blob_message_filter.cc +++ b/content/browser/renderer_host/blob_message_filter.cc @@ -1,12 +1,12 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. #include "content/browser/renderer_host/blob_message_filter.h" -#include "chrome/common/render_messages.h" #include "content/browser/child_process_security_policy.h" #include "content/browser/chrome_blob_storage_context.h" +#include "content/common/webblob_messages.h" #include "googleurl/src/gurl.h" #include "webkit/blob/blob_data.h" #include "webkit/blob/blob_storage_controller.h" @@ -38,9 +38,9 @@ bool BlobMessageFilter::OnMessageReceived(const IPC::Message& message, bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(BlobMessageFilter, message, *message_was_ok) - IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterBlobUrl, OnRegisterBlobUrl) - IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom) - IPC_MESSAGE_HANDLER(ViewHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl) + IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrl, OnRegisterBlobUrl) + IPC_MESSAGE_HANDLER(BlobHostMsg_RegisterBlobUrlFrom, OnRegisterBlobUrlFrom) + IPC_MESSAGE_HANDLER(BlobHostMsg_UnregisterBlobUrl, OnUnregisterBlobUrl) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc index 4570559..ae08752 100644 --- a/content/common/common_param_traits.cc +++ b/content/common/common_param_traits.cc @@ -555,4 +555,104 @@ void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { p.width(), p.height())); } +// Only the webkit_blob::BlobData ParamTraits<> definition needs this +// definition, so keep this in the implementation file so we can forward declare +// BlobData in the header. +template <> +struct ParamTraits<webkit_blob::BlobData::Item> { + typedef webkit_blob::BlobData::Item param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, static_cast<int>(p.type())); + if (p.type() == webkit_blob::BlobData::TYPE_DATA) { + WriteParam(m, p.data()); + } else if (p.type() == webkit_blob::BlobData::TYPE_FILE) { + WriteParam(m, p.file_path()); + WriteParam(m, p.offset()); + WriteParam(m, p.length()); + WriteParam(m, p.expected_modification_time()); + } else { + WriteParam(m, p.blob_url()); + WriteParam(m, p.offset()); + WriteParam(m, p.length()); + } + } + static bool Read(const Message* m, void** iter, param_type* r) { + int type; + if (!ReadParam(m, iter, &type)) + return false; + if (type == webkit_blob::BlobData::TYPE_DATA) { + std::string data; + if (!ReadParam(m, iter, &data)) + return false; + r->SetToData(data); + } else if (type == webkit_blob::BlobData::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->SetToFile(file_path, offset, length, expected_modification_time); + } else { + DCHECK(type == webkit_blob::BlobData::TYPE_BLOB); + GURL blob_url; + uint64 offset, length; + if (!ReadParam(m, iter, &blob_url)) + return false; + if (!ReadParam(m, iter, &offset)) + return false; + if (!ReadParam(m, iter, &length)) + return false; + r->SetToBlob(blob_url, offset, length); + } + return true; + } + static void Log(const param_type& p, std::string* l) { + l->append("<BlobData::Item>"); + } +}; + +void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Write( + Message* m, const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p) { + WriteParam(m, p->items()); + WriteParam(m, p->content_type()); + WriteParam(m, p->content_disposition()); + } +} + +bool ParamTraits<scoped_refptr<webkit_blob::BlobData> >::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<webkit_blob::BlobData::Item> items; + if (!ReadParam(m, iter, &items)) + return false; + std::string content_type; + if (!ReadParam(m, iter, &content_type)) + return false; + std::string content_disposition; + if (!ReadParam(m, iter, &content_disposition)) + return false; + *r = new webkit_blob::BlobData; + (*r)->swap_items(&items); + (*r)->set_content_type(content_type); + (*r)->set_content_disposition(content_disposition); + return true; +} + +void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Log( + const param_type& p, std::string* l) { + l->append("<webkit_blob::BlobData>"); +} + } // namespace IPC diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index 2448377..96b4d0d 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -21,6 +21,7 @@ #include "net/base/ip_endpoint.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 @@ -29,6 +30,7 @@ // TODO(erg): The following headers are historical and only work because // their definitions are inlined, which also needs to be fixed. #include "ui/gfx/native_widget_types.h" +#include "webkit/blob/blob_data.h" #include "webkit/glue/resource_type.h" // Forward declarations. @@ -194,6 +196,14 @@ struct ParamTraits<gfx::NativeWindow> { } }; +template <> +struct ParamTraits<scoped_refptr<webkit_blob::BlobData > > { + typedef scoped_refptr<webkit_blob::BlobData> 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 ea2717f..68c16e8 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -13,4 +13,5 @@ #include "content/common/mime_registry_messages.h" #include "content/common/resource_messages.h" #include "content/common/socket_stream_messages.h" +#include "content/common/webblob_messages.h" #include "content/common/worker_messages.h" diff --git a/content/common/webblob_messages.h b/content/common/webblob_messages.h new file mode 100644 index 0000000..b96f5cf --- /dev/null +++ b/content/common/webblob_messages.h @@ -0,0 +1,28 @@ +// 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 HTML5 Blob. +// Multiply-included message file, hence no include guard. + +#include "content/common/common_param_traits.h" +#include "ipc/ipc_message_macros.h" + +#define IPC_MESSAGE_START BlobMsgStart + +// Blob messages sent from the renderer to the browser. + +// Registers a blob URL referring to the specified blob data. +IPC_MESSAGE_CONTROL2(BlobHostMsg_RegisterBlobUrl, + GURL /* url */, + scoped_refptr<webkit_blob::BlobData> /* blob_data */) + +// Registers a blob URL referring to the blob data identified by the specified +// source URL. +IPC_MESSAGE_CONTROL2(BlobHostMsg_RegisterBlobUrlFrom, + GURL /* url */, + GURL /* src_url */) + +// Unregister a blob URL. +IPC_MESSAGE_CONTROL1(BlobHostMsg_UnregisterBlobUrl, + GURL /* url */) diff --git a/chrome/common/webblobregistry_impl.cc b/content/common/webblobregistry_impl.cc index cd74d50..c8568ed 100644 --- a/chrome/common/webblobregistry_impl.cc +++ b/content/common/webblobregistry_impl.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// 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. -#include "chrome/common/webblobregistry_impl.h" +#include "content/common/webblobregistry_impl.h" #include "base/ref_counted.h" -#include "chrome/common/render_messages.h" +#include "content/common/webblob_messages.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobData.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" @@ -26,14 +26,14 @@ void WebBlobRegistryImpl::registerBlobURL( const WebURL& url, WebBlobData& data) { scoped_refptr<webkit_blob::BlobData> blob_data( new webkit_blob::BlobData(data)); - sender_->Send(new ViewHostMsg_RegisterBlobUrl(url, blob_data)); + sender_->Send(new BlobHostMsg_RegisterBlobUrl(url, blob_data)); } void WebBlobRegistryImpl::registerBlobURL( const WebURL& url, const WebURL& src_url) { - sender_->Send(new ViewHostMsg_RegisterBlobUrlFrom(url, src_url)); + sender_->Send(new BlobHostMsg_RegisterBlobUrlFrom(url, src_url)); } void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { - sender_->Send(new ViewHostMsg_UnregisterBlobUrl(url)); + sender_->Send(new BlobHostMsg_UnregisterBlobUrl(url)); } diff --git a/chrome/common/webblobregistry_impl.h b/content/common/webblobregistry_impl.h index 73395d9..73395d9 100644 --- a/chrome/common/webblobregistry_impl.h +++ b/content/common/webblobregistry_impl.h diff --git a/content/content_common.gypi b/content/content_common.gypi index 6d2a5d8..326bfcc 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -11,6 +11,7 @@ '../ipc/ipc.gyp:ipc', '../third_party/icu/icu.gyp:icuuc', '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', + '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:fileapi', ], 'include_dirs': [ @@ -102,6 +103,9 @@ 'common/socket_stream_dispatcher.cc', 'common/socket_stream_dispatcher.h', 'common/socket_stream_messages.h', + 'common/webblobregistry_impl.cc', + 'common/webblobregistry_impl.h', + 'common/webblob_messages.h', 'common/worker_messages.h', ], 'conditions': [ diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 7272302..07db0ee 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -75,6 +75,7 @@ enum IPCMessageStart { FileSystemMsgStart, ChildProcessMsgStart, ClipboardMsgStart, + BlobMsgStart, }; class DictionaryValue; |