summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 20:00:41 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 20:00:41 +0000
commit19a5c744bf18b7e7b233fe2de250275f58ed9562 (patch)
tree7d87a52f17e950b380a44c67f1b27c3ec5a47ae9 /content/common
parentc92f4ed1c339ad9a413a6945e5e6c71f397187a1 (diff)
downloadchromium_src-19a5c744bf18b7e7b233fe2de250275f58ed9562.zip
chromium_src-19a5c744bf18b7e7b233fe2de250275f58ed9562.tar.gz
chromium_src-19a5c744bf18b7e7b233fe2de250275f58ed9562.tar.bz2
Move common_param_traits and webkit_param_traits to content/public/common.
BUG=98716 Review URL: http://codereview.chromium.org/8368004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/clipboard_messages.h2
-rw-r--r--content/common/common_param_traits.cc567
-rw-r--r--content/common/common_param_traits.h247
-rw-r--r--content/common/dom_storage_messages.h2
-rw-r--r--content/common/drag_messages.h2
-rw-r--r--content/common/file_utilities_messages.h2
-rw-r--r--content/common/gpu/gpu_messages.h2
-rw-r--r--content/common/java_bridge_messages.h2
-rw-r--r--content/common/mac/attributed_string_coder.mm2
-rw-r--r--content/common/media/video_capture_messages.h2
-rw-r--r--content/common/mime_registry_messages.h2
-rw-r--r--content/common/pepper_file_messages.h2
-rw-r--r--content/common/plugin_messages.h4
-rw-r--r--content/common/resource_messages.h2
-rw-r--r--content/common/utility_messages.h2
-rw-r--r--content/common/view_messages.h4
-rw-r--r--content/common/webblob_messages.h4
-rw-r--r--content/common/webkit_param_traits.cc347
-rw-r--r--content/common/webkit_param_traits.h249
19 files changed, 18 insertions, 1428 deletions
diff --git a/content/common/clipboard_messages.h b/content/common/clipboard_messages.h
index c0f7d60..72a15f3 100644
--- a/content/common/clipboard_messages.h
+++ b/content/common/clipboard_messages.h
@@ -8,7 +8,7 @@
#include <vector>
#include "base/shared_memory.h"
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "ui/base/clipboard/clipboard.h"
diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc
deleted file mode 100644
index c630105..0000000
--- a/content/common/common_param_traits.cc
+++ /dev/null
@@ -1,567 +0,0 @@
-// 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/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 "third_party/skia/include/core/SkBitmap.h"
-#include "ui/base/range/range.h"
-#include "ui/gfx/rect.h"
-
-namespace {
-
-struct SkBitmap_Data {
- // The configuration for the bitmap (bits per pixel, etc).
- SkBitmap::Config fConfig;
-
- // The width of the bitmap in pixels.
- uint32 fWidth;
-
- // The height of the bitmap in pixels.
- uint32 fHeight;
-
- void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
- fConfig = bitmap.config();
- fWidth = bitmap.width();
- fHeight = bitmap.height();
- }
-
- // Returns whether |bitmap| successfully initialized.
- bool InitSkBitmapFromData(SkBitmap* bitmap, const char* pixels,
- size_t total_pixels) const {
- if (total_pixels) {
- bitmap->setConfig(fConfig, fWidth, fHeight, 0);
- if (!bitmap->allocPixels())
- return false;
- if (total_pixels != bitmap->getSize())
- return false;
- memcpy(bitmap->getPixels(), pixels, total_pixels);
- }
- return true;
- }
-};
-
-} // namespace
-
-namespace IPC {
-
-void ParamTraits<GURL>::Write(Message* m, const GURL& p) {
- m->WriteString(p.possibly_invalid_spec());
- // TODO(brettw) bug 684583: Add encoding for query params.
-}
-
-bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) {
- std::string s;
- if (!m->ReadString(iter, &s) || s.length() > content::kMaxURLChars) {
- *p = GURL();
- return false;
- }
- *p = GURL(s);
- return true;
-}
-
-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::STYLESHEET:
- type = "STYLESHEET";
- break;
- case ResourceType::SCRIPT:
- type = "SCRIPT";
- break;
- case ResourceType::IMAGE:
- type = "IMAGE";
- break;
- case ResourceType::FONT_RESOURCE:
- type = "FONT_RESOURCE";
- break;
- case ResourceType::SUB_RESOURCE:
- type = "SUB_RESOURCE";
- break;
- case ResourceType::OBJECT:
- type = "OBJECT";
- break;
- case ResourceType::MEDIA:
- type = "MEDIA";
- break;
- case ResourceType::WORKER:
- type = "WORKER";
- break;
- case ResourceType::SHARED_WORKER:
- type = "SHARED_WORKER";
- break;
- case ResourceType::PREFETCH:
- type = "PREFETCH";
- break;
- case ResourceType::PRERENDER:
- type = "PRERENDER";
- break;
- case ResourceType::FAVICON:
- type = "FAVICON";
- break;
- case ResourceType::XHR:
- type = "XHR";
- 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.error());
-}
-
-bool ParamTraits<net::URLRequestStatus>::Read(const Message* m, void** iter,
- param_type* r) {
- int status, error;
- if (!ReadParam(m, iter, &status) || !ReadParam(m, iter, &error))
- return false;
- r->set_status(static_cast<net::URLRequestStatus::Status>(status));
- r->set_error(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.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<net::IPEndPoint>::Write(Message* m, const param_type& p) {
- WriteParam(m, p.address());
- WriteParam(m, p.port());
-}
-
-bool ParamTraits<net::IPEndPoint>::Read(const Message* m, void** iter,
- param_type* p) {
- net::IPAddressNumber address;
- int port;
- if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port))
- return false;
- *p = net::IPEndPoint(address, port);
- return true;
-}
-
-void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
- LogParam("IPEndPoint:" + p.ToString(), l);
-}
-
-void ParamTraits<base::PlatformFileInfo>::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.size);
- WriteParam(m, p.is_directory);
- WriteParam(m, p.last_modified.ToDoubleT());
- WriteParam(m, p.last_accessed.ToDoubleT());
- WriteParam(m, p.creation_time.ToDoubleT());
-}
-
-bool ParamTraits<base::PlatformFileInfo>::Read(
- const Message* m, void** iter, param_type* p) {
- double last_modified;
- double last_accessed;
- double creation_time;
- bool result =
- ReadParam(m, iter, &p->size) &&
- ReadParam(m, iter, &p->is_directory) &&
- ReadParam(m, iter, &last_modified) &&
- ReadParam(m, iter, &last_accessed) &&
- ReadParam(m, iter, &creation_time);
- if (result) {
- p->last_modified = base::Time::FromDoubleT(last_modified);
- p->last_accessed = base::Time::FromDoubleT(last_accessed);
- p->creation_time = base::Time::FromDoubleT(creation_time);
- }
- return result;
-}
-
-void ParamTraits<base::PlatformFileInfo>::Log(
- const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.size, l);
- l->append(",");
- LogParam(p.is_directory, l);
- l->append(",");
- LogParam(p.last_modified.ToDoubleT(), l);
- l->append(",");
- LogParam(p.last_accessed.ToDoubleT(), l);
- l->append(",");
- LogParam(p.creation_time.ToDoubleT(), l);
- l->append(")");
-}
-
-void ParamTraits<gfx::Point>::Write(Message* m, const gfx::Point& p) {
- m->WriteInt(p.x());
- m->WriteInt(p.y());
-}
-
-bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter,
- gfx::Point* r) {
- int x, y;
- if (!m->ReadInt(iter, &x) ||
- !m->ReadInt(iter, &y))
- return false;
- r->set_x(x);
- r->set_y(y);
- return true;
-}
-
-void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::string* l) {
- l->append(base::StringPrintf("(%d, %d)", p.x(), p.y()));
-}
-
-void ParamTraits<gfx::Size>::Write(Message* m, const gfx::Size& p) {
- m->WriteInt(p.width());
- m->WriteInt(p.height());
-}
-
-bool ParamTraits<gfx::Size>::Read(const Message* m, void** iter, gfx::Size* r) {
- int w, h;
- if (!m->ReadInt(iter, &w) ||
- !m->ReadInt(iter, &h))
- return false;
- r->set_width(w);
- r->set_height(h);
- return true;
-}
-
-void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) {
- l->append(base::StringPrintf("(%d, %d)", p.width(), p.height()));
-}
-
-void ParamTraits<gfx::Rect>::Write(Message* m, const gfx::Rect& p) {
- m->WriteInt(p.x());
- m->WriteInt(p.y());
- m->WriteInt(p.width());
- m->WriteInt(p.height());
-}
-
-bool ParamTraits<gfx::Rect>::Read(const Message* m, void** iter, gfx::Rect* r) {
- int x, y, w, h;
- if (!m->ReadInt(iter, &x) ||
- !m->ReadInt(iter, &y) ||
- !m->ReadInt(iter, &w) ||
- !m->ReadInt(iter, &h))
- return false;
- r->set_x(x);
- r->set_y(y);
- r->set_width(w);
- r->set_height(h);
- return true;
-}
-
-void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) {
- l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(),
- p.width(), p.height()));
-}
-
-void ParamTraits<ui::Range>::Write(Message* m, const ui::Range& r) {
- m->WriteSize(r.start());
- m->WriteSize(r.end());
-}
-
-bool ParamTraits<ui::Range>::Read(const Message* m, void** iter, ui::Range* r) {
- size_t start, end;
- if (!m->ReadSize(iter, &start) || !m->ReadSize(iter, &end))
- return false;
- r->set_start(start);
- r->set_end(end);
- return true;
-}
-
-void ParamTraits<ui::Range>::Log(const ui::Range& r, std::string* l) {
- l->append(base::StringPrintf("(%"PRIuS", %"PRIuS")", r.start(), r.end()));
-}
-
-void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) {
- size_t fixed_size = sizeof(SkBitmap_Data);
- SkBitmap_Data bmp_data;
- bmp_data.InitSkBitmapDataForTransfer(p);
- m->WriteData(reinterpret_cast<const char*>(&bmp_data),
- static_cast<int>(fixed_size));
- size_t pixel_size = p.getSize();
- SkAutoLockPixels p_lock(p);
- m->WriteData(reinterpret_cast<const char*>(p.getPixels()),
- static_cast<int>(pixel_size));
-}
-
-bool ParamTraits<SkBitmap>::Read(const Message* m, void** iter, SkBitmap* r) {
- const char* fixed_data;
- int fixed_data_size = 0;
- if (!m->ReadData(iter, &fixed_data, &fixed_data_size) ||
- (fixed_data_size <= 0)) {
- NOTREACHED();
- return false;
- }
- if (fixed_data_size != sizeof(SkBitmap_Data))
- return false; // Message is malformed.
-
- const char* variable_data;
- int variable_data_size = 0;
- if (!m->ReadData(iter, &variable_data, &variable_data_size) ||
- (variable_data_size < 0)) {
- NOTREACHED();
- return false;
- }
- const SkBitmap_Data* bmp_data =
- reinterpret_cast<const SkBitmap_Data*>(fixed_data);
- return bmp_data->InitSkBitmapFromData(r, variable_data, variable_data_size);
-}
-
-void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::string* l) {
- l->append("<SkBitmap>");
-}
-
-} // namespace IPC
diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h
deleted file mode 100644
index 1357497..0000000
--- a/content/common/common_param_traits.h
+++ /dev/null
@@ -1,247 +0,0 @@
-// 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.
-
-// This file is used to define IPC::ParamTraits<> specializations for a number
-// of types so that they can be serialized over IPC. IPC::ParamTraits<>
-// specializations for basic types (like int and std::string) and types in the
-// 'base' project can be found in ipc/ipc_message_utils.h. This file contains
-// specializations for types that are used by the content code, and which need
-// manual serialization code. This is usually because they're not structs with
-// public members..
-
-#ifndef CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
-#define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
-#pragma once
-
-#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
-#include "content/common/content_export.h"
-#include "content/common/dom_storage_common.h"
-#include "content/public/common/page_transition_types.h"
-#include "googleurl/src/gurl.h"
-#include "ipc/ipc_message_utils.h"
-#include "net/base/ip_endpoint.h"
-#include "net/url_request/url_request_status.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/surface/transport_dib.h"
-#include "webkit/glue/resource_type.h"
-
-class SkBitmap;
-
-namespace gfx {
-class Point;
-class Rect;
-class Size;
-} // namespace gfx
-
-namespace net {
-class HttpResponseHeaders;
-class HostPortPair;
-class UploadData;
-}
-
-namespace ui {
-class Range;
-}
-
-namespace IPC {
-
-template <>
-struct CONTENT_EXPORT ParamTraits<GURL> {
- typedef GURL 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<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 CONTENT_EXPORT 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 CONTENT_EXPORT 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 CONTENT_EXPORT 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<net::IPEndPoint> {
- typedef net::IPEndPoint 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<base::PlatformFileInfo> {
- typedef base::PlatformFileInfo 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 CONTENT_EXPORT ParamTraits<gfx::Point> {
- typedef gfx::Point 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 CONTENT_EXPORT ParamTraits<gfx::Size> {
- typedef gfx::Size 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 CONTENT_EXPORT ParamTraits<gfx::Rect> {
- typedef gfx::Rect 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<gfx::NativeWindow> {
- typedef gfx::NativeWindow param_type;
- static void Write(Message* m, const param_type& p) {
-#if defined(OS_WIN)
- // HWNDs are always 32 bits on Windows, even on 64 bit systems.
- m->WriteUInt32(reinterpret_cast<uint32>(p));
-#else
- m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p));
-#endif
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
-#if defined(OS_WIN)
- return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
-#else
- const char *data;
- int data_size = 0;
- bool result = m->ReadData(iter, &data, &data_size);
- if (result && data_size == sizeof(gfx::NativeWindow)) {
- memcpy(r, data, sizeof(gfx::NativeWindow));
- } else {
- result = false;
- NOTREACHED();
- }
- return result;
-#endif
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<gfx::NativeWindow>");
- }
-};
-
-template <>
-struct CONTENT_EXPORT ParamTraits<ui::Range> {
- typedef ui::Range 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);
-};
-
-#if defined(OS_WIN)
-template<>
-struct ParamTraits<TransportDIB::Id> {
- typedef TransportDIB::Id param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.handle);
- WriteParam(m, p.sequence_num);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return (ReadParam(m, iter, &r->handle) &&
- ReadParam(m, iter, &r->sequence_num));
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("TransportDIB(");
- LogParam(p.handle, l);
- l->append(", ");
- LogParam(p.sequence_num, l);
- l->append(")");
- }
-};
-#endif
-
-#if defined(USE_X11)
-template<>
-struct ParamTraits<TransportDIB::Id> {
- typedef TransportDIB::Id param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.shmkey);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return ReadParam(m, iter, &r->shmkey);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("TransportDIB(");
- LogParam(p.shmkey, l);
- l->append(")");
- }
-};
-#endif
-
-template <>
-struct CONTENT_EXPORT ParamTraits<SkBitmap> {
- typedef SkBitmap param_type;
- static void Write(Message* m, const param_type& p);
-
- // Note: This function expects parameter |r| to be of type &SkBitmap since
- // r->SetConfig() and r->SetPixels() are called.
- static bool Read(const Message* m, void** iter, param_type* r);
-
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct SimilarTypeTraits<base::PlatformFileError> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<DOMStorageType> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<content::PageTransition> {
- typedef int Type;
-};
-
-} // namespace IPC
-
-#endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
diff --git a/content/common/dom_storage_messages.h b/content/common/dom_storage_messages.h
index 165e96b..a284ac0 100644
--- a/content/common/dom_storage_messages.h
+++ b/content/common/dom_storage_messages.h
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Multiply-included message file, no traditional include guard.
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h
index a8ac21f..f4e1cd7 100644
--- a/content/common/drag_messages.h
+++ b/content/common/drag_messages.h
@@ -5,7 +5,7 @@
// IPC messages for drag and drop.
// Multiply-included message file, hence no include guard.
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
diff --git a/content/common/file_utilities_messages.h b/content/common/file_utilities_messages.h
index f19325f..08ceced 100644
--- a/content/common/file_utilities_messages.h
+++ b/content/common/file_utilities_messages.h
@@ -5,7 +5,7 @@
// Multiply-included message file, so no include guard.
#include "base/time.h"
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "ipc/ipc_platform_file.h"
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index c9ffc4c..906a195 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/shared_memory.h"
-#include "content/common/common_param_traits.h"
#include "content/common/gpu/gpu_process_launch_causes.h"
+#include "content/public/common/common_param_traits.h"
#include "content/public/common/gpu_info.h"
#include "gpu/command_buffer/common/command_buffer.h"
#include "gpu/command_buffer/common/constants.h"
diff --git a/content/common/java_bridge_messages.h b/content/common/java_bridge_messages.h
index 8dd2353..4329f71 100644
--- a/content/common/java_bridge_messages.h
+++ b/content/common/java_bridge_messages.h
@@ -6,7 +6,7 @@
// Multiply-included message file, hence no include guard.
-#include "content/common/webkit_param_traits.h" // For NPVariant_Param
+#include "content/public/common/webkit_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
diff --git a/content/common/mac/attributed_string_coder.mm b/content/common/mac/attributed_string_coder.mm
index ca4847d..706368d 100644
--- a/content/common/mac/attributed_string_coder.mm
+++ b/content/common/mac/attributed_string_coder.mm
@@ -10,8 +10,8 @@
#include "base/memory/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
-#include "content/common/common_param_traits.h"
#include "content/common/view_messages.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_utils.h"
namespace mac {
diff --git a/content/common/media/video_capture_messages.h b/content/common/media/video_capture_messages.h
index 0a5e0e7..0112d85 100644
--- a/content/common/media/video_capture_messages.h
+++ b/content/common/media/video_capture_messages.h
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/shared_memory.h"
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "media/video/capture/video_capture.h"
diff --git a/content/common/mime_registry_messages.h b/content/common/mime_registry_messages.h
index 0fd47bd..559f0ac 100644
--- a/content/common/mime_registry_messages.h
+++ b/content/common/mime_registry_messages.h
@@ -5,7 +5,7 @@
// Multiply-included message file, so no include guard.
#include "base/file_path.h"
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
diff --git a/content/common/pepper_file_messages.h b/content/common/pepper_file_messages.h
index 1bcafa1..941824d 100644
--- a/content/common/pepper_file_messages.h
+++ b/content/common/pepper_file_messages.h
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Multiply-included message file, no traditional include guard.
-#include "content/common/common_param_traits.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_param_traits.h"
#include "ipc/ipc_platform_file.h"
diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h
index 8b57345..d5f073c 100644
--- a/content/common/plugin_messages.h
+++ b/content/common/plugin_messages.h
@@ -5,9 +5,9 @@
// Multiply-included message file, hence no include guard.
#include "build/build_config.h"
-#include "content/common/common_param_traits.h"
#include "content/common/content_export.h"
-#include "content/common/webkit_param_traits.h"
+#include "content/public/common/common_param_traits.h"
+#include "content/public/common/webkit_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ui/gfx/native_widget_types.h"
diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h
index c37bb69..b132a13e 100644
--- a/content/common/resource_messages.h
+++ b/content/common/resource_messages.h
@@ -6,8 +6,8 @@
// Multiply-included message file, hence no include guard.
#include "base/shared_memory.h"
-#include "content/common/common_param_traits.h"
#include "content/common/resource_response.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/upload_data.h"
diff --git a/content/common/utility_messages.h b/content/common/utility_messages.h
index 2cee196..05dcde5 100644
--- a/content/common/utility_messages.h
+++ b/content/common/utility_messages.h
@@ -8,10 +8,10 @@
#include <vector>
#include "base/basictypes.h"
-#include "content/common/common_param_traits.h"
#include "content/common/indexed_db_key.h"
#include "content/common/indexed_db_param_traits.h"
#include "content/common/serialized_script_value.h"
+#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "webkit/plugins/webplugininfo.h"
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index c73c1a7..d7571bd 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -7,7 +7,6 @@
#include "base/process.h"
#include "base/shared_memory.h"
-#include "content/common/common_param_traits.h"
#include "content/common/content_export.h"
#include "content/common/css_colors.h"
#include "content/common/edit_command.h"
@@ -15,7 +14,8 @@
#include "content/common/page_zoom.h"
#include "content/common/renderer_preferences.h"
#include "content/common/view_message_enums.h"
-#include "content/common/webkit_param_traits.h"
+#include "content/public/common/common_param_traits.h"
+#include "content/public/common/webkit_param_traits.h"
#include "content/public/common/window_container_type.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
diff --git a/content/common/webblob_messages.h b/content/common/webblob_messages.h
index 6fcd61f..7715454 100644
--- a/content/common/webblob_messages.h
+++ b/content/common/webblob_messages.h
@@ -5,8 +5,8 @@
// IPC messages for HTML5 Blob.
// Multiply-included message file, hence no include guard.
-#include "content/common/common_param_traits.h"
-#include "content/common/webkit_param_traits.h"
+#include "content/public/common/common_param_traits.h"
+#include "content/public/common/webkit_param_traits.h"
#include "ipc/ipc_message_macros.h"
#define IPC_MESSAGE_START BlobMsgStart
diff --git a/content/common/webkit_param_traits.cc b/content/common/webkit_param_traits.cc
deleted file mode 100644
index a10eaa8..0000000
--- a/content/common/webkit_param_traits.cc
+++ /dev/null
@@ -1,347 +0,0 @@
-// 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.
-
-// NOTE: New trait definitions that will be used by Chrome Frame must be placed
-// in common_param_traits2.cc.
-
-#include "content/common/webkit_param_traits.h"
-
-#include "base/string_number_conversions.h"
-#include "content/common/common_param_traits.h"
-#include "content/common/content_constants.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
-#include "webkit/glue/password_form.h"
-#include "webkit/glue/resource_loader_bridge.h"
-
-NPIdentifier_Param::NPIdentifier_Param()
- : identifier() {
-}
-
-NPIdentifier_Param::~NPIdentifier_Param() {
-}
-
-NPVariant_Param::NPVariant_Param()
- : type(NPVARIANT_PARAM_VOID),
- bool_value(false),
- int_value(0),
- double_value(0),
- npobject_routing_id(-1) {
-}
-
-NPVariant_Param::~NPVariant_Param() {
-}
-
-namespace IPC {
-
-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);
- WriteParam(m, p->request_headers_text);
- WriteParam(m, p->response_headers_text);
- }
-}
-
-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) &&
- ReadParam(m, iter, &(*r)->request_headers_text) &&
- ReadParam(m, iter, &(*r)->response_headers_text);
-}
-
-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(")");
-}
-
-void ParamTraits<NPVariant_Param>::Write(Message* m, const param_type& p) {
- WriteParam(m, static_cast<int>(p.type));
- if (p.type == NPVARIANT_PARAM_BOOL) {
- WriteParam(m, p.bool_value);
- } else if (p.type == NPVARIANT_PARAM_INT) {
- WriteParam(m, p.int_value);
- } else if (p.type == NPVARIANT_PARAM_DOUBLE) {
- WriteParam(m, p.double_value);
- } else if (p.type == NPVARIANT_PARAM_STRING) {
- WriteParam(m, p.string_value);
- } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- // This is the routing id used to connect NPObjectProxy in the other
- // process with NPObjectStub in this process or to identify the raw
- // npobject pointer to be used in the callee process.
- WriteParam(m, p.npobject_routing_id);
- } else {
- DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL);
- }
-}
-
-bool ParamTraits<NPVariant_Param>::Read(const Message* m,
- void** iter,
- param_type* r) {
- int type;
- if (!ReadParam(m, iter, &type))
- return false;
-
- bool result = false;
- r->type = static_cast<NPVariant_ParamEnum>(type);
- if (r->type == NPVARIANT_PARAM_BOOL) {
- result = ReadParam(m, iter, &r->bool_value);
- } else if (r->type == NPVARIANT_PARAM_INT) {
- result = ReadParam(m, iter, &r->int_value);
- } else if (r->type == NPVARIANT_PARAM_DOUBLE) {
- result = ReadParam(m, iter, &r->double_value);
- } else if (r->type == NPVARIANT_PARAM_STRING) {
- result = ReadParam(m, iter, &r->string_value);
- } else if (r->type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- r->type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- result = ReadParam(m, iter, &r->npobject_routing_id);
- } else if ((r->type == NPVARIANT_PARAM_VOID) ||
- (r->type == NPVARIANT_PARAM_NULL)) {
- result = true;
- } else {
- NOTREACHED();
- }
-
- return result;
-}
-
-void ParamTraits<NPVariant_Param>::Log(const param_type& p, std::string* l) {
- l->append(StringPrintf("NPVariant_Param(%d, ", static_cast<int>(p.type)));
- if (p.type == NPVARIANT_PARAM_BOOL) {
- LogParam(p.bool_value, l);
- } else if (p.type == NPVARIANT_PARAM_INT) {
- LogParam(p.int_value, l);
- } else if (p.type == NPVARIANT_PARAM_DOUBLE) {
- LogParam(p.double_value, l);
- } else if (p.type == NPVARIANT_PARAM_STRING) {
- LogParam(p.string_value, l);
- } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID ||
- p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) {
- LogParam(p.npobject_routing_id, l);
- } else {
- l->append("<none>");
- }
- l->append(")");
-}
-
-void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) {
- webkit_glue::SerializeNPIdentifier(p.identifier, m);
-}
-
-bool ParamTraits<NPIdentifier_Param>::Read(const Message* m,
- void** iter,
- param_type* r) {
- return webkit_glue::DeserializeNPIdentifier(*m, iter, &r->identifier);
-}
-
-void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) {
- if (WebKit::WebBindings::identifierIsString(p.identifier)) {
- NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier);
- l->append(str);
- NPN_MemFree(str);
- } else {
- l->append(base::IntToString(
- WebKit::WebBindings::intFromIdentifier(p.identifier)));
- }
-}
-
-void ParamTraits<webkit::WebPluginMimeType>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, p.mime_type);
- WriteParam(m, p.file_extensions);
- WriteParam(m, p.description);
- WriteParam(m, p.additional_param_names);
- WriteParam(m, p.additional_param_values);
-}
-
-bool ParamTraits<webkit::WebPluginMimeType>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->mime_type) &&
- ReadParam(m, iter, &p->file_extensions) &&
- ReadParam(m, iter, &p->description) &&
- ReadParam(m, iter, &p->additional_param_names) &&
- ReadParam(m, iter, &p->additional_param_values);
-}
-
-void ParamTraits<webkit::WebPluginMimeType>::Log(
- const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p.mime_type, l); l->append(", ");
- LogParam(p.file_extensions, l); l->append(", ");
- LogParam(p.description, l); l->append(", ");
- LogParam(p.additional_param_names, l); l->append(", ");
- LogParam(p.additional_param_values, l);
- l->append(")");
-}
-
-void ParamTraits<webkit::WebPluginInfo>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, p.name);
- WriteParam(m, p.path);
- WriteParam(m, p.version);
- WriteParam(m, p.desc);
- WriteParam(m, p.mime_types);
- WriteParam(m, p.type);
-}
-
-bool ParamTraits<webkit::WebPluginInfo>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->name) &&
- ReadParam(m, iter, &p->path) &&
- ReadParam(m, iter, &p->version) &&
- ReadParam(m, iter, &p->desc) &&
- ReadParam(m, iter, &p->mime_types) &&
- ReadParam(m, iter, &p->type);
-}
-void ParamTraits<webkit::WebPluginInfo>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.name, l); l->append(", ");
- LogParam(p.path, l); l->append(", ");
- LogParam(p.version, l); l->append(", ");
- LogParam(p.desc, l); l->append(", ");
- LogParam(p.mime_types, l); l->append(", ");
- LogParam(p.type, l);
- l->append(")");
-}
-
-void ParamTraits<webkit_glue::PasswordForm>::Write(Message* m,
- const param_type& p) {
- WriteParam(m, p.signon_realm);
- WriteParam(m, p.origin);
- WriteParam(m, p.action);
- WriteParam(m, p.submit_element);
- WriteParam(m, p.username_element);
- WriteParam(m, p.username_value);
- WriteParam(m, p.password_element);
- WriteParam(m, p.password_value);
- WriteParam(m, p.old_password_element);
- WriteParam(m, p.old_password_value);
- WriteParam(m, p.ssl_valid);
- WriteParam(m, p.preferred);
- WriteParam(m, p.blacklisted_by_user);
-}
-
-bool ParamTraits<webkit_glue::PasswordForm>::Read(const Message* m, void** iter,
- param_type* p) {
- return
- ReadParam(m, iter, &p->signon_realm) &&
- ReadParam(m, iter, &p->origin) &&
- ReadParam(m, iter, &p->action) &&
- ReadParam(m, iter, &p->submit_element) &&
- ReadParam(m, iter, &p->username_element) &&
- ReadParam(m, iter, &p->username_value) &&
- ReadParam(m, iter, &p->password_element) &&
- ReadParam(m, iter, &p->password_value) &&
- ReadParam(m, iter, &p->old_password_element) &&
- ReadParam(m, iter, &p->old_password_value) &&
- ReadParam(m, iter, &p->ssl_valid) &&
- ReadParam(m, iter, &p->preferred) &&
- ReadParam(m, iter, &p->blacklisted_by_user);
-}
-void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p,
- std::string* l) {
- l->append("<PasswordForm>");
-}
-
-} // namespace IPC
diff --git a/content/common/webkit_param_traits.h b/content/common/webkit_param_traits.h
deleted file mode 100644
index 8bf9973..0000000
--- a/content/common/webkit_param_traits.h
+++ /dev/null
@@ -1,249 +0,0 @@
-// 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.
-
-// This file is used to define IPC::ParamTraits<> specializations for a number
-// of WebKit types so that they can be serialized over IPC. IPC::ParamTraits<>
-// specializations for basic types (like int and std::string) and types in the
-// 'base' project can be found in ipc/ipc_message_utils.h. This file contains
-// specializations for types that are used by the content code, and which need
-// manual serialization code. This is usually because they're not structs with
-// public members.
-
-#ifndef CONTENT_COMMON_WEBKIT_PARAM_TRAITS_H_
-#define CONTENT_COMMON_WEBKIT_PARAM_TRAITS_H_
-#pragma once
-
-#include <string>
-
-#include "base/memory/ref_counted.h"
-#include "content/common/content_export.h"
-#include "ipc/ipc_message_utils.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebTextDirection.h"
-#include "webkit/blob/blob_data.h"
-#include "webkit/glue/npruntime_util.h"
-#include "webkit/glue/resource_type.h"
-#include "webkit/glue/webcursor.h"
-#include "webkit/glue/window_open_disposition.h"
-#include "webkit/plugins/webplugininfo.h"
-
-namespace webkit_glue {
-struct PasswordForm;
-struct ResourceDevToolsInfo;
-struct ResourceLoadTimingInfo;
-}
-
-// Define the NPVariant_Param struct and its enum here since it needs manual
-// serialization code.
-enum NPVariant_ParamEnum {
- NPVARIANT_PARAM_VOID,
- NPVARIANT_PARAM_NULL,
- NPVARIANT_PARAM_BOOL,
- NPVARIANT_PARAM_INT,
- NPVARIANT_PARAM_DOUBLE,
- NPVARIANT_PARAM_STRING,
- // Used when when the NPObject is running in the caller's process, so we
- // create an NPObjectProxy in the other process.
- NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID,
- // Used when the NPObject we're sending is running in the callee's process
- // (i.e. we have an NPObjectProxy for it). In that case we want the callee
- // to just use the raw pointer.
- NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID,
-};
-
-struct NPVariant_Param {
- NPVariant_Param();
- ~NPVariant_Param();
-
- NPVariant_ParamEnum type;
- bool bool_value;
- int int_value;
- double double_value;
- std::string string_value;
- int npobject_routing_id;
-};
-
-struct NPIdentifier_Param {
- NPIdentifier_Param();
- ~NPIdentifier_Param();
-
- NPIdentifier identifier;
-};
-
-namespace IPC {
-
-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);
-};
-
-template <>
-struct ParamTraits<NPVariant_Param> {
- typedef NPVariant_Param 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<NPIdentifier_Param> {
- typedef NPIdentifier_Param 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::WebPluginMimeType> {
- typedef webkit::WebPluginMimeType 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 CONTENT_EXPORT ParamTraits<webkit::WebPluginInfo> {
- typedef webkit::WebPluginInfo 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<WebCursor> {
- typedef WebCursor param_type;
- static void Write(Message* m, const param_type& p) {
- p.Serialize(m);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return r->Deserialize(m, iter);
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("<WebCursor>");
- }
-};
-
-template <>
-struct ParamTraits<WebKit::WebInputEvent::Type> {
- typedef WebKit::WebInputEvent::Type param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<WebKit::WebInputEvent::Type>(type);
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- const char* type;
- switch (p) {
- case WebKit::WebInputEvent::MouseDown:
- type = "MouseDown";
- break;
- case WebKit::WebInputEvent::MouseUp:
- type = "MouseUp";
- break;
- case WebKit::WebInputEvent::MouseMove:
- type = "MouseMove";
- break;
- case WebKit::WebInputEvent::MouseLeave:
- type = "MouseLeave";
- break;
- case WebKit::WebInputEvent::MouseEnter:
- type = "MouseEnter";
- break;
- case WebKit::WebInputEvent::MouseWheel:
- type = "MouseWheel";
- break;
- case WebKit::WebInputEvent::RawKeyDown:
- type = "RawKeyDown";
- break;
- case WebKit::WebInputEvent::KeyDown:
- type = "KeyDown";
- break;
- case WebKit::WebInputEvent::KeyUp:
- type = "KeyUp";
- break;
- default:
- type = "None";
- break;
- }
- LogParam(std::string(type), l);
- }
-};
-
-typedef const WebKit::WebInputEvent* WebInputEventPointer;
-template <>
-struct ParamTraits<WebInputEventPointer> {
- typedef WebInputEventPointer param_type;
- static void Write(Message* m, const param_type& p) {
- m->WriteData(reinterpret_cast<const char*>(p), p->size);
- }
- // Note: upon read, the event has the lifetime of the message.
- static bool Read(const Message* m, void** iter, param_type* r) {
- const char* data;
- int data_length;
- if (!m->ReadData(iter, &data, &data_length)) {
- NOTREACHED();
- return false;
- }
- if (data_length < static_cast<int>(sizeof(WebKit::WebInputEvent))) {
- NOTREACHED();
- return false;
- }
- param_type event = reinterpret_cast<param_type>(data);
- // Check that the data size matches that of the event (we check the latter
- // in the delegate).
- if (data_length != static_cast<int>(event->size)) {
- NOTREACHED();
- return false;
- }
- *r = event;
- return true;
- }
- static void Log(const param_type& p, std::string* l) {
- l->append("(");
- LogParam(p->size, l);
- l->append(", ");
- LogParam(p->type, l);
- l->append(", ");
- LogParam(p->timeStampSeconds, l);
- l->append(")");
- }
-};
-
-template <>
-struct SimilarTypeTraits<WebKit::WebTextDirection> {
- typedef int Type;
-};
-
-template <>
-struct SimilarTypeTraits<WindowOpenDisposition> {
- typedef int Type;
-};
-
-template <>
-struct CONTENT_EXPORT ParamTraits<webkit_glue::PasswordForm> {
- typedef webkit_glue::PasswordForm 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);
-};
-
-} // namespace IPC
-
-#endif // CONTENT_COMMON_WEBKIT_PARAM_TRAITS_H_