diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 00:21:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 00:21:47 +0000 |
commit | db10d8fe8c04b6026bd9e27723694e496c763893 (patch) | |
tree | 20c62ab9c05f239ec32446cb2876affd9a9aa6e7 /chrome | |
parent | b2d79d2f07f43899f8ece7dd9753c2955b685dd8 (diff) | |
download | chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.zip chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.tar.gz chromium_src-db10d8fe8c04b6026bd9e27723694e496c763893.tar.bz2 |
Move the blob related code to content, and also move the blob messages to their own file.
TBR=jianli
Review URL: http://codereview.chromium.org/6681028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-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/common/webblobregistry_impl.cc | 39 | ||||
-rw-r--r-- | chrome/common/webblobregistry_impl.h | 35 | ||||
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 2 | ||||
-rw-r--r-- | chrome/worker/worker_webkitclient_impl.cc | 2 |
7 files changed, 2 insertions, 205 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/common/webblobregistry_impl.cc b/chrome/common/webblobregistry_impl.cc deleted file mode 100644 index cd74d50..0000000 --- a/chrome/common/webblobregistry_impl.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2010 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 "base/ref_counted.h" -#include "chrome/common/render_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" -#include "webkit/blob/blob_data.h" - -using WebKit::WebBlobData; -using WebKit::WebString; -using WebKit::WebURL; - -WebBlobRegistryImpl::WebBlobRegistryImpl(IPC::Message::Sender* sender) - : sender_(sender) { -} - -WebBlobRegistryImpl::~WebBlobRegistryImpl() { -} - -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)); -} - -void WebBlobRegistryImpl::registerBlobURL( - const WebURL& url, const WebURL& src_url) { - sender_->Send(new ViewHostMsg_RegisterBlobUrlFrom(url, src_url)); -} - -void WebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { - sender_->Send(new ViewHostMsg_UnregisterBlobUrl(url)); -} diff --git a/chrome/common/webblobregistry_impl.h b/chrome/common/webblobregistry_impl.h deleted file mode 100644 index 73395d9..0000000 --- a/chrome/common/webblobregistry_impl.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2010 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. - -#ifndef CHROME_COMMON_WEBBLOBREGISTRY_IMPL_H_ -#define CHROME_COMMON_WEBBLOBREGISTRY_IMPL_H_ -#pragma once - -#include "ipc/ipc_message.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobRegistry.h" - -namespace WebKit { -class WebBlobData; -class WebBlobStorageData; -class WebString; -class WebURL; -} - -class WebBlobRegistryImpl : public WebKit::WebBlobRegistry { - public: - explicit WebBlobRegistryImpl(IPC::Message::Sender* sender); - virtual ~WebBlobRegistryImpl(); - - // See WebBlobRegistry.h for documentation on these functions. - virtual void registerBlobURL(const WebKit::WebURL& url, - WebKit::WebBlobData& data); - virtual void registerBlobURL(const WebKit::WebURL& url, - const WebKit::WebURL& src_url); - virtual void unregisterBlobURL(const WebKit::WebURL& url); - - private: - IPC::Message::Sender* sender_; -}; - -#endif // CHROME_COMMON_WEBBLOBREGISTRY_IMPL_H_ 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" |