summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 08:58:19 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-04 08:58:19 +0000
commit7d5c3acd124fae8816416374f629752138ec08e1 (patch)
treee7c0eb48729c056ed4bbafbd3816fafd269a8f15 /chrome/common
parent13a9e86809ec0b88304afe5d2126d24b6750a327 (diff)
downloadchromium_src-7d5c3acd124fae8816416374f629752138ec08e1.zip
chromium_src-7d5c3acd124fae8816416374f629752138ec08e1.tar.gz
chromium_src-7d5c3acd124fae8816416374f629752138ec08e1.tar.bz2
Revert my change to get the tree green. Not sure why the tests became flaky. I'll try to check them in again but in smaller chunks tomorrow.
TBR=mpcomplete Review URL: http://codereview.chromium.org/21039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/common.scons3
-rw-r--r--chrome/common/common.vcproj8
-rw-r--r--chrome/common/ipc_fuzzing_tests.cc7
-rw-r--r--chrome/common/ipc_logging.cc30
-rw-r--r--chrome/common/ipc_logging.h17
-rw-r--r--chrome/common/ipc_message_macros.h54
-rw-r--r--chrome/common/ipc_message_unittest.cc6
-rw-r--r--chrome/common/ipc_message_utils.cc29
-rw-r--r--chrome/common/ipc_message_utils.h447
-rw-r--r--chrome/common/ipc_sync_channel_unittest.cc7
-rw-r--r--chrome/common/ipc_sync_message_unittest.cc8
-rw-r--r--chrome/common/ipc_sync_message_unittest.h11
-rw-r--r--chrome/common/plugin_messages.h352
-rw-r--r--chrome/common/plugin_messages_internal.h10
-rw-r--r--chrome/common/render_messages.h1296
-rw-r--r--chrome/common/render_messages_internal.h14
-rw-r--r--chrome/common/resource_bundle.h3
-rw-r--r--chrome/common/resource_dispatcher_unittest.cc6
-rw-r--r--chrome/common/security_filter_peer.h2
-rw-r--r--chrome/common/temp_scaffolding_stubs.h9
20 files changed, 1148 insertions, 1171 deletions
diff --git a/chrome/common/common.scons b/chrome/common/common.scons
index 7e5cc14..ae4c0bf 100644
--- a/chrome/common/common.scons
+++ b/chrome/common/common.scons
@@ -94,8 +94,10 @@ input_files = ChromeFileList([
'ipc_sync_channel.h',
'ipc_sync_message.cc',
'ipc_sync_message.h',
+ 'plugin_messages.cc',
'plugin_messages.h',
'plugin_messages_internal.h',
+ 'render_messages.cc',
'render_messages.h',
'render_messages_internal.h',
]),
@@ -227,6 +229,7 @@ if not env.Bit('windows'):
'gfx/path.cc',
'ipc_logging.cc',
'os_exchange_data.cc',
+ 'plugin_messages.cc',
'process_watcher.cc',
)
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index c3986d2b..c0f6af6 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -285,6 +285,10 @@
>
</File>
<File
+ RelativePath=".\plugin_messages.cc"
+ >
+ </File>
+ <File
RelativePath=".\plugin_messages.h"
>
</File>
@@ -293,6 +297,10 @@
>
</File>
<File
+ RelativePath=".\render_messages.cc"
+ >
+ </File>
+ <File
RelativePath=".\render_messages.h"
>
</File>
diff --git a/chrome/common/ipc_fuzzing_tests.cc b/chrome/common/ipc_fuzzing_tests.cc
index 6e67844..cbd2bd3 100644
--- a/chrome/common/ipc_fuzzing_tests.cc
+++ b/chrome/common/ipc_fuzzing_tests.cc
@@ -96,9 +96,10 @@ TEST(IPCMessageIntegrity, ReadVectorTooLarge2) {
EXPECT_FALSE(ReadParam(&m, &iter, &vec));
}
-// We don't actually use the messages defined in this fiel, but we do this
-// to get to the IPC macros.
-#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
+// Typically the ipc_message_macros files is included twice but here we only
+// include it once in 'enum mode' because we want more control of the class
+// definitions.
+#define IPC_MESSAGE_MACROS_ENUMS
#include "chrome/common/ipc_message_macros.h"
enum IPCMessageIds {
diff --git a/chrome/common/ipc_logging.cc b/chrome/common/ipc_logging.cc
index 2946093..ec2fe82 100644
--- a/chrome/common/ipc_logging.cc
+++ b/chrome/common/ipc_logging.cc
@@ -41,8 +41,6 @@ Logging::Logging()
consumer_(NULL),
queue_invoke_later_pending_(false),
main_thread_(MessageLoop::current()) {
- memset(log_function_mapping_, sizeof(log_function_mapping_), 0);
-
// Create an event for this browser instance that's set when logging is
// enabled, so child processes can know when logging is enabled.
int browser_pid;
@@ -90,18 +88,8 @@ void Logging::OnObjectSignaled(HANDLE object) {
RegisterWaitForEvent(!enabled_);
}
-void Logging::RegisterMessageLogger(int msg_start, LogFunction* func) {
- int msg_class = msg_start >> 12;
- if (msg_class > arraysize(log_function_mapping_)) {
- NOTREACHED();
- return;
- }
-
- log_function_mapping_[msg_class] = func;
-}
-
std::wstring Logging::GetEventName(bool enabled) {
- return current()->GetEventName(GetCurrentProcessId(), enabled);
+ return Logging::current()->GetEventName(GetCurrentProcessId(), enabled);
}
std::wstring Logging::GetEventName(int browser_pid, bool enabled) {
@@ -200,12 +188,24 @@ void Logging::OnPostDispatchMessage(const Message& message,
}
}
+// static
+LogFunction* g_log_function_mapping[16];
+void RegisterMessageLogger(int msg_start, LogFunction* func) {
+ int msg_class = msg_start >> 12;
+ if (msg_class > arraysize(g_log_function_mapping)) {
+ NOTREACHED();
+ return;
+ }
+
+ g_log_function_mapping[msg_class] = func;
+}
+
void Logging::GetMessageText(uint16 type, std::wstring* name,
const Message* message,
std::wstring* params) {
int message_class = type >> 12;
- if (current()->log_function_mapping_[message_class] != NULL) {
- current()->log_function_mapping_[message_class](type, name, message, params);
+ if (g_log_function_mapping[message_class] != NULL) {
+ g_log_function_mapping[message_class](type, name, message, params);
} else {
DLOG(INFO) << "No logger function associated with message class " <<
message_class;
diff --git a/chrome/common/ipc_logging.h b/chrome/common/ipc_logging.h
index bf49595..567ba84 100644
--- a/chrome/common/ipc_logging.h
+++ b/chrome/common/ipc_logging.h
@@ -12,7 +12,6 @@
#include "base/lock.h"
#include "base/object_watcher.h"
#include "base/singleton.h"
-#include "chrome/common/ipc_message_utils.h"
class MessageLoop;
@@ -28,7 +27,7 @@ class Logging : public base::ObjectWatcher::Delegate {
// Implemented by consumers of log messages.
class Consumer {
public:
- virtual void Log(const LogData& data) = 0;
+ virtual void Log(const IPC::LogData& data) = 0;
};
void SetConsumer(Consumer* consumer);
@@ -42,7 +41,7 @@ class Logging : public base::ObjectWatcher::Delegate {
// Called by child processes to give the logger object the channel to send
// logging data to the browser process.
- void SetIPCSender(Message::Sender* sender);
+ void SetIPCSender(IPC::Message::Sender* sender);
// Called in the browser process when logging data from a child process is
// received.
@@ -67,14 +66,8 @@ class Logging : public base::ObjectWatcher::Delegate {
// ObjectWatcher::Delegate implementation
void OnObjectSignaled(HANDLE object);
- typedef void (LogFunction)(uint16 type,
- std::wstring* name,
- const Message* msg,
- std::wstring* params);
- void RegisterMessageLogger(int msg_start, LogFunction* func);
-
private:
- friend struct DefaultSingletonTraits<Logging>;
+ friend struct DefaultSingletonTraits<IPC::Logging>;
Logging();
std::wstring GetEventName(int browser_pid, bool enabled);
@@ -92,12 +85,10 @@ class Logging : public base::ObjectWatcher::Delegate {
std::vector<LogData> queued_logs_;
bool queue_invoke_later_pending_;
- Message::Sender* sender_;
+ IPC::Message::Sender* sender_;
MessageLoop* main_thread_;
Consumer* consumer_;
-
- LogFunction* log_function_mapping_[LastMsgIndex];
};
} // namespace IPC
diff --git a/chrome/common/ipc_message_macros.h b/chrome/common/ipc_message_macros.h
index 49c15b5..e724e2e 100644
--- a/chrome/common/ipc_message_macros.h
+++ b/chrome/common/ipc_message_macros.h
@@ -41,33 +41,6 @@
#include "chrome/common/ipc_message_utils.h"
-
-#ifndef MESSAGES_INTERNAL_FILE
-#error This file should only be included by X_messages.h, which needs to define MESSAGES_INTERNAL_FILE first.
-#endif
-
-#ifndef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
-#define IPC_MESSAGE_MACROS_INCLUDE_BLOCK
-
-// Multi-pass include of X_messages_internal.h. Preprocessor magic allows
-// us to use 1 header to define the enums and classes for our render messages.
-#define IPC_MESSAGE_MACROS_ENUMS
-#include MESSAGES_INTERNAL_FILE
-
-#define IPC_MESSAGE_MACROS_CLASSES
-#include MESSAGES_INTERNAL_FILE
-
-#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
-#define IPC_MESSAGE_MACROS_LOG
-#include MESSAGES_INTERNAL_FILE
-#endif
-
-#undef MESSAGES_INTERNAL_FILE
-#undef IPC_MESSAGE_MACROS_INCLUDE_BLOCK
-
-#endif
-
-
// Undefine the macros from the previous pass (if any).
#undef IPC_BEGIN_MESSAGES
#undef IPC_END_MESSAGES
@@ -84,6 +57,7 @@
#undef IPC_MESSAGE_ROUTED4
#undef IPC_MESSAGE_ROUTED5
#undef IPC_MESSAGE_ROUTED6
+#undef IPC_MESSAGE_EMPTY
#undef IPC_SYNC_MESSAGE_CONTROL0_0
#undef IPC_SYNC_MESSAGE_CONTROL0_1
#undef IPC_SYNC_MESSAGE_CONTROL0_2
@@ -120,7 +94,6 @@
#undef IPC_SYNC_MESSAGE_ROUTED4_0
#undef IPC_SYNC_MESSAGE_ROUTED4_1
-
#if defined(IPC_MESSAGE_MACROS_ENUMS)
#undef IPC_MESSAGE_MACROS_ENUMS
@@ -129,11 +102,10 @@
// 16 channel types (currently using 8) and 4K messages per type. Should
// really make type be 32 bits, but then we break automation with older Chrome
// builds..
-
-#define IPC_BEGIN_MESSAGES(label) \
+#define IPC_BEGIN_MESSAGES(label, start) \
enum label##MsgType { \
- label##Start = label##MsgStart << 12, \
- label##PreStart = (label##MsgStart << 12) - 1, // Do this so that automation messages keep the same id as before
+ label##Start = start << 12, \
+ label##PreStart = (start << 12) - 1, // Do this so that automation messages keep the same id as before
#define IPC_END_MESSAGES(label) \
label##End \
@@ -178,6 +150,9 @@
#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
msg_class##__ID,
+#define IPC_MESSAGE_EMPTY(msg_class) \
+ msg_class##__ID,
+
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
msg_class##__ID,
@@ -366,7 +341,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#elif defined(IPC_MESSAGE_MACROS_LOG)
#undef IPC_MESSAGE_MACROS_LOG
-#define IPC_BEGIN_MESSAGES(label) \
+#define IPC_BEGIN_MESSAGES(label, start) \
void label##MsgLog(uint16 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
switch (type) {
@@ -424,6 +399,9 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
IPC_MESSAGE_LOG(msg_class)
+#define IPC_MESSAGE_EMPTY(msg_class) \
+ IPC_MESSAGE_LOG(msg_class)
+
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
IPC_MESSAGE_LOG(msg_class)
@@ -532,7 +510,7 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#elif defined(IPC_MESSAGE_MACROS_CLASSES)
#undef IPC_MESSAGE_MACROS_CLASSES
-#define IPC_BEGIN_MESSAGES(label)
+#define IPC_BEGIN_MESSAGES(label, start)
#define IPC_END_MESSAGES(label)
#define IPC_MESSAGE_CONTROL0(msg_class) \
@@ -677,6 +655,14 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
routing_id, ID, MakeTuple(arg1, arg2, arg3, arg4, arg5, arg6)) {} \
};
+// Dummy class for now, just to give us the ID field.
+#define IPC_MESSAGE_EMPTY(msg_class) \
+ class msg_class { \
+ public: \
+ enum { ID = msg_class##__ID }; \
+ static void Log(const IPC::Message* msg, std::wstring* l) {} \
+ };
+
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
class msg_class : public IPC::MessageWithReply<Tuple0, Tuple0 > { \
public: \
diff --git a/chrome/common/ipc_message_unittest.cc b/chrome/common/ipc_message_unittest.cc
index d6ff045..8596185 100644
--- a/chrome/common/ipc_message_unittest.cc
+++ b/chrome/common/ipc_message_unittest.cc
@@ -20,11 +20,11 @@ TEST(IPCMessageTest, Serialize) {
for (size_t i = 0; i < arraysize(serialize_cases); i++) {
GURL input(serialize_cases[i]);
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
- ParamTraits<GURL>::Write(&msg, input);
+ IPC::ParamTraits<GURL>::Write(&msg, input);
GURL output;
void* iter = NULL;
- EXPECT_TRUE(ParamTraits<GURL>::Read(&msg, &iter, &output));
+ EXPECT_TRUE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output));
// We want to test each component individually to make sure its range was
// correctly serialized and deserialized, not just the spec.
@@ -45,6 +45,6 @@ TEST(IPCMessageTest, Serialize) {
msg.WriteInt(99);
GURL output;
void* iter = NULL;
- EXPECT_FALSE(ParamTraits<GURL>::Read(&msg, &iter, &output));
+ EXPECT_FALSE(IPC::ParamTraits<GURL>::Read(&msg, &iter, &output));
}
diff --git a/chrome/common/ipc_message_utils.cc b/chrome/common/ipc_message_utils.cc
index cf82dc8..2512ff4 100644
--- a/chrome/common/ipc_message_utils.cc
+++ b/chrome/common/ipc_message_utils.cc
@@ -9,6 +9,8 @@
#include "SkBitmap.h"
#include "webkit/glue/dom_operations.h"
+namespace IPC {
+
namespace {
struct SkBitmap_Data {
@@ -44,7 +46,7 @@ struct SkBitmap_Data {
} // namespace
-void ParamTraits<SkBitmap>::Write(IPC::Message* m, const SkBitmap& p) {
+void ParamTraits<SkBitmap>::Write(Message* m, const SkBitmap& p) {
size_t fixed_size = sizeof(SkBitmap_Data);
SkBitmap_Data bmp_data;
bmp_data.InitSkBitmapDataForTransfer(p);
@@ -56,7 +58,7 @@ void ParamTraits<SkBitmap>::Write(IPC::Message* m, const SkBitmap& p) {
static_cast<int>(pixel_size));
}
-bool ParamTraits<SkBitmap>::Read(const IPC::Message* m, void** iter, SkBitmap* r) {
+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) ||
@@ -85,12 +87,12 @@ void ParamTraits<SkBitmap>::Log(const SkBitmap& p, std::wstring* l) {
}
-void ParamTraits<GURL>::Write(IPC::Message* m, const GURL& p) {
+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 IPC::Message* m, void** iter, GURL* p) {
+bool ParamTraits<GURL>::Read(const Message* m, void** iter, GURL* p) {
std::string s;
if (!m->ReadString(iter, &s)) {
*p = GURL();
@@ -105,12 +107,12 @@ void ParamTraits<GURL>::Log(const GURL& p, std::wstring* l) {
}
-void ParamTraits<gfx::Point>::Write(IPC::Message* m, const gfx::Point& p) {
+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 IPC::Message* m, void** iter,
+bool ParamTraits<gfx::Point>::Read(const Message* m, void** iter,
gfx::Point* r) {
int x, y;
if (!m->ReadInt(iter, &x) ||
@@ -126,14 +128,14 @@ void ParamTraits<gfx::Point>::Log(const gfx::Point& p, std::wstring* l) {
}
-void ParamTraits<gfx::Rect>::Write(IPC::Message* m, const gfx::Rect& p) {
+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 IPC::Message* m, void** iter, gfx::Rect* r) {
+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) ||
@@ -153,12 +155,12 @@ void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::wstring* l) {
}
-void ParamTraits<gfx::Size>::Write(IPC::Message* m, const gfx::Size& p) {
+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 IPC::Message* m, void** iter, gfx::Size* r) {
+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))
@@ -173,7 +175,7 @@ void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::wstring* l) {
}
void ParamTraits<webkit_glue::WebApplicationInfo>::Write(
- IPC::Message* m, const webkit_glue::WebApplicationInfo& p) {
+ Message* m, const webkit_glue::WebApplicationInfo& p) {
WriteParam(m, p.title);
WriteParam(m, p.description);
WriteParam(m, p.app_url);
@@ -186,7 +188,7 @@ void ParamTraits<webkit_glue::WebApplicationInfo>::Write(
}
bool ParamTraits<webkit_glue::WebApplicationInfo>::Read(
- const IPC::Message* m, void** iter, webkit_glue::WebApplicationInfo* r) {
+ const Message* m, void** iter, webkit_glue::WebApplicationInfo* r) {
size_t icon_count;
bool result =
ReadParam(m, iter, &r->title) &&
@@ -210,3 +212,6 @@ void ParamTraits<webkit_glue::WebApplicationInfo>::Log(
const webkit_glue::WebApplicationInfo& p, std::wstring* l) {
l->append(L"<WebApplicationInfo>");
}
+
+} // namespace IPC
+
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 35146ee..39bb231 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -34,30 +34,57 @@ namespace webkit_glue {
struct WebApplicationInfo;
} // namespace webkit_glue
-// Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique
-// base. Messages have unique IDs across channels in order for the IPC logging
-// code to figure out the message class from its ID.
-enum IPCMessageStart {
- // By using a start value of 0 for automation messages, we keep backward
- // compatibility with old builds.
- AutomationMsgStart = 0,
- ViewMsgStart,
- ViewHostMsgStart,
- PluginProcessMsgStart,
- PluginProcessHostMsgStart,
- PluginMsgStart,
- PluginHostMsgStart,
- NPObjectMsgStart,
- TestMsgStart,
- // NOTE: When you add a new message class, also update
- // IPCStatusView::IPCStatusView to ensure logging works.
- // NOTE: this enum is used by IPC_MESSAGE_MACRO to generate a unique message
- // id. Only 4 bits are used for the message type, so if this enum needs more
- // than 16 entries, that code needs to be updated.
- LastMsgIndex
-};
+namespace IPC {
+
+// Used by the message macros to register a logging function based on the
+// message class.
+typedef void (LogFunction)(uint16 type,
+ std::wstring* name,
+ const IPC::Message* msg,
+ std::wstring* params);
+void RegisterMessageLogger(int msg_start, LogFunction* func);
+
+
+//-----------------------------------------------------------------------------
+// An iterator class for reading the fields contained within a Message.
-COMPILE_ASSERT(LastMsgIndex <= 16, need_to_update_IPC_MESSAGE_MACRO);
+class MessageIterator {
+ public:
+ explicit MessageIterator(const Message& m) : msg_(m), iter_(NULL) {
+ }
+ int NextInt() const {
+ int val;
+ if (!msg_.ReadInt(&iter_, &val))
+ NOTREACHED();
+ return val;
+ }
+ intptr_t NextIntPtr() const {
+ intptr_t val;
+ if (!msg_.ReadIntPtr(&iter_, &val))
+ NOTREACHED();
+ return val;
+ }
+ const std::string NextString() const {
+ std::string val;
+ if (!msg_.ReadString(&iter_, &val))
+ NOTREACHED();
+ return val;
+ }
+ const std::wstring NextWString() const {
+ std::wstring val;
+ if (!msg_.ReadWString(&iter_, &val))
+ NOTREACHED();
+ return val;
+ }
+ const void NextData(const char** data, int* length) const {
+ if (!msg_.ReadData(&iter_, data, length)) {
+ NOTREACHED();
+ }
+ }
+ private:
+ const Message& msg_;
+ mutable void* iter_;
+};
//-----------------------------------------------------------------------------
// ParamTraits specializations, etc.
@@ -65,12 +92,12 @@ COMPILE_ASSERT(LastMsgIndex <= 16, need_to_update_IPC_MESSAGE_MACRO);
template <class P> struct ParamTraits {};
template <class P>
-static inline void WriteParam(IPC::Message* m, const P& p) {
+static inline void WriteParam(Message* m, const P& p) {
ParamTraits<P>::Write(m, p);
}
template <class P>
-static inline bool ReadParam(const IPC::Message* m, void** iter, P* p) {
+static inline bool ReadParam(const Message* m, void** iter, P* p) {
return ParamTraits<P>::Read(m, iter, p);
}
@@ -82,10 +109,10 @@ static inline void LogParam(const P& p, std::wstring* l) {
template <>
struct ParamTraits<bool> {
typedef bool param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteBool(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadBool(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -96,10 +123,10 @@ struct ParamTraits<bool> {
template <>
struct ParamTraits<int> {
typedef int param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -110,10 +137,10 @@ struct ParamTraits<int> {
template <>
struct ParamTraits<long> {
typedef long param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteLong(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadLong(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -124,10 +151,10 @@ struct ParamTraits<long> {
template <>
struct ParamTraits<size_t> {
typedef size_t param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteSize(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadSize(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -141,10 +168,10 @@ struct ParamTraits<size_t> {
template <>
struct ParamTraits<uint32> {
typedef uint32 param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteUInt32(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadUInt32(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -156,10 +183,10 @@ struct ParamTraits<uint32> {
template <>
struct ParamTraits<int64> {
typedef int64 param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt64(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt64(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -170,10 +197,10 @@ struct ParamTraits<int64> {
template <>
struct ParamTraits<uint64> {
typedef uint64 param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt64(static_cast<int64>(p));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt64(iter, reinterpret_cast<int64*>(r));
}
static void Log(const param_type& p, std::wstring* l) {
@@ -184,10 +211,10 @@ struct ParamTraits<uint64> {
template <>
struct ParamTraits<double> {
typedef double param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(param_type));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
bool result = m->ReadData(iter, &data, &data_size);
@@ -208,10 +235,10 @@ struct ParamTraits<double> {
template <>
struct ParamTraits<wchar_t> {
typedef wchar_t param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(param_type));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
bool result = m->ReadData(iter, &data, &data_size);
@@ -232,10 +259,10 @@ struct ParamTraits<wchar_t> {
template <>
struct ParamTraits<base::Time> {
typedef base::Time param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
ParamTraits<int64>::Write(m, p.ToInternalValue());
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int64 value;
if (!ParamTraits<int64>::Read(m, iter, &value))
return false;
@@ -251,10 +278,10 @@ struct ParamTraits<base::Time> {
template <>
struct ParamTraits<LOGFONT> {
typedef LOGFONT param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(LOGFONT));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
bool result = m->ReadData(iter, &data, &data_size);
@@ -275,10 +302,10 @@ struct ParamTraits<LOGFONT> {
template <>
struct ParamTraits<MSG> {
typedef MSG param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(MSG));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
bool result = m->ReadData(iter, &data, &data_size);
@@ -297,11 +324,11 @@ struct ParamTraits<MSG> {
template <>
struct ParamTraits<SkBitmap> {
typedef SkBitmap param_type;
- static void Write(IPC::Message* m, const param_type& p);
+ 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 IPC::Message* m, void** iter, param_type* r);
+ static bool Read(const Message* m, void** iter, param_type* r);
static void Log(const param_type& p, std::wstring* l);
};
@@ -309,10 +336,10 @@ struct ParamTraits<SkBitmap> {
template <>
struct ParamTraits<std::string> {
typedef std::string param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteString(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadString(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -323,7 +350,7 @@ struct ParamTraits<std::string> {
template <>
struct ParamTraits<std::vector<unsigned char> > {
typedef std::vector<unsigned char> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
if (p.size() == 0) {
m->WriteData(NULL, 0);
} else {
@@ -331,7 +358,7 @@ struct ParamTraits<std::vector<unsigned char> > {
static_cast<int>(p.size()));
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
if (!m->ReadData(iter, &data, &data_size) || data_size < 0)
@@ -350,14 +377,14 @@ struct ParamTraits<std::vector<unsigned char> > {
template <>
struct ParamTraits<std::vector<char> > {
typedef std::vector<char> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
if (p.size() == 0) {
m->WriteData(NULL, 0);
} else {
m->WriteData(&p.front(), static_cast<int>(p.size()));
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
if (!m->ReadData(iter, &data, &data_size) || data_size < 0)
@@ -376,12 +403,12 @@ struct ParamTraits<std::vector<char> > {
template <class P>
struct ParamTraits<std::vector<P> > {
typedef std::vector<P> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.size()));
for (size_t i = 0; i < p.size(); i++)
WriteParam(m, p[i]);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int size;
if (!m->ReadLength(iter, &size))
return false;
@@ -415,7 +442,7 @@ struct ParamTraits<std::vector<P> > {
template <class K, class V>
struct ParamTraits<std::map<K, V> > {
typedef std::map<K, V> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.size()));
typename param_type::const_iterator iter;
for (iter = p.begin(); iter != p.end(); ++iter) {
@@ -423,7 +450,7 @@ struct ParamTraits<std::map<K, V> > {
WriteParam(m, iter->second);
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int size;
if (!ReadParam(m, iter, &size) || size < 0)
return false;
@@ -445,10 +472,10 @@ struct ParamTraits<std::map<K, V> > {
template <>
struct ParamTraits<std::wstring> {
typedef std::wstring param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteWString(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadWString(iter, r);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -459,8 +486,8 @@ struct ParamTraits<std::wstring> {
template <>
struct ParamTraits<GURL> {
typedef GURL param_type;
- static void Write(IPC::Message* m, const param_type& p);
- static bool Read(const IPC::Message* m, void** iter, param_type* p);
+ 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::wstring* l);
};
@@ -469,10 +496,10 @@ struct ParamTraits<GURL> {
template <>
struct ParamTraits<HANDLE> {
typedef HANDLE param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
}
@@ -484,10 +511,10 @@ struct ParamTraits<HANDLE> {
template <>
struct ParamTraits<HCURSOR> {
typedef HCURSOR param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
}
@@ -499,10 +526,10 @@ struct ParamTraits<HCURSOR> {
template <>
struct ParamTraits<HWND> {
typedef HWND param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
}
@@ -514,7 +541,7 @@ struct ParamTraits<HWND> {
template <>
struct ParamTraits<HRGN> {
typedef HRGN param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
int data_size = GetRegionData(p, 0, NULL);
if (data_size) {
char* bytes = new char[data_size];
@@ -525,7 +552,7 @@ struct ParamTraits<HRGN> {
m->WriteData(NULL, 0);
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
bool res = FALSE;
const char *data;
int data_size = 0;
@@ -547,10 +574,10 @@ struct ParamTraits<HRGN> {
template <>
struct ParamTraits<HACCEL> {
typedef HACCEL param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
DCHECK_EQ(sizeof(param_type), sizeof(intptr_t));
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
}
@@ -559,11 +586,11 @@ struct ParamTraits<HACCEL> {
template <>
struct ParamTraits<POINT> {
typedef POINT param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p.x);
m->WriteInt(p.y);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int x, y;
if (!m->ReadInt(iter, &x) || !m->ReadInt(iter, &y))
return false;
@@ -580,10 +607,10 @@ struct ParamTraits<POINT> {
template <>
struct ParamTraits<FilePath> {
typedef FilePath param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
ParamTraits<FilePath::StringType>::Write(m, p.value());
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
FilePath::StringType value;
if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value))
return false;
@@ -598,44 +625,44 @@ struct ParamTraits<FilePath> {
template <>
struct ParamTraits<gfx::Point> {
typedef gfx::Point param_type;
- static void Write(IPC::Message* m, const param_type& p);
- static bool Read(const IPC::Message* m, void** iter, param_type* r);
+ 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::wstring* l);
};
template <>
struct ParamTraits<gfx::Rect> {
typedef gfx::Rect param_type;
- static void Write(IPC::Message* m, const param_type& p);
- static bool Read(const IPC::Message* m, void** iter, param_type* r);
+ 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::wstring* l);
};
template <>
struct ParamTraits<gfx::Size> {
typedef gfx::Size param_type;
- static void Write(IPC::Message* m, const param_type& p);
- static bool Read(const IPC::Message* m, void** iter, param_type* r);
+ 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::wstring* l);
};
template<>
struct ParamTraits<ThumbnailScore> {
typedef ThumbnailScore param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- ParamTraits<double>::Write(m, p.boring_score);
- ParamTraits<bool>::Write(m, p.good_clipping);
- ParamTraits<bool>::Write(m, p.at_top);
- ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
+ static void Write(Message* m, const param_type& p) {
+ IPC::ParamTraits<double>::Write(m, p.boring_score);
+ IPC::ParamTraits<bool>::Write(m, p.good_clipping);
+ IPC::ParamTraits<bool>::Write(m, p.at_top);
+ IPC::ParamTraits<base::Time>::Write(m, p.time_at_snapshot);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
double boring_score;
bool good_clipping, at_top;
base::Time time_at_snapshot;
- if (!ParamTraits<double>::Read(m, iter, &boring_score) ||
- !ParamTraits<bool>::Read(m, iter, &good_clipping) ||
- !ParamTraits<bool>::Read(m, iter, &at_top) ||
- !ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot))
+ if (!IPC::ParamTraits<double>::Read(m, iter, &boring_score) ||
+ !IPC::ParamTraits<bool>::Read(m, iter, &good_clipping) ||
+ !IPC::ParamTraits<bool>::Read(m, iter, &at_top) ||
+ !IPC::ParamTraits<base::Time>::Read(m, iter, &time_at_snapshot))
return false;
r->boring_score = boring_score;
@@ -653,10 +680,10 @@ struct ParamTraits<ThumbnailScore> {
template <>
struct ParamTraits<WindowOpenDisposition> {
typedef WindowOpenDisposition param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int temp;
bool res = m->ReadInt(iter, &temp);
*r = static_cast<WindowOpenDisposition>(temp);
@@ -670,10 +697,10 @@ struct ParamTraits<WindowOpenDisposition> {
template <>
struct ParamTraits<ConsoleMessageLevel> {
typedef ConsoleMessageLevel param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int temp;
bool res = m->ReadInt(iter, &temp);
*r = static_cast<ConsoleMessageLevel>(temp);
@@ -687,13 +714,13 @@ struct ParamTraits<ConsoleMessageLevel> {
template <>
struct ParamTraits<CacheManager::ResourceTypeStat> {
typedef CacheManager::ResourceTypeStat param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.count);
WriteParam(m, p.size);
WriteParam(m, p.live_size);
WriteParam(m, p.decoded_size);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
bool result =
ReadParam(m, iter, &r->count) &&
ReadParam(m, iter, &r->size) &&
@@ -710,14 +737,14 @@ struct ParamTraits<CacheManager::ResourceTypeStat> {
template <>
struct ParamTraits<CacheManager::ResourceTypeStats> {
typedef CacheManager::ResourceTypeStats param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.images);
WriteParam(m, p.css_stylesheets);
WriteParam(m, p.scripts);
WriteParam(m, p.xsl_stylesheets);
WriteParam(m, p.fonts);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
bool result =
ReadParam(m, iter, &r->images) &&
ReadParam(m, iter, &r->css_stylesheets) &&
@@ -741,10 +768,10 @@ struct ParamTraits<CacheManager::ResourceTypeStats> {
template <>
struct ParamTraits<XFORM> {
typedef XFORM param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteData(reinterpret_cast<const char*>(&p), sizeof(XFORM));
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
int data_size = 0;
bool result = m->ReadData(iter, &data, &data_size);
@@ -766,10 +793,10 @@ struct ParamTraits<XFORM> {
template <>
struct ParamTraits<WebCursor> {
typedef WebCursor param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
p.Serialize(m);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return r->Deserialize(m, iter);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -777,8 +804,6 @@ struct ParamTraits<WebCursor> {
}
};
-namespace IPC {
-
struct LogData {
std::wstring channel;
uint16 type;
@@ -791,12 +816,10 @@ struct LogData {
std::wstring params;
};
-}
-
template <>
-struct ParamTraits<IPC::LogData> {
- typedef IPC::LogData param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+struct ParamTraits<LogData> {
+ typedef LogData param_type;
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.channel);
WriteParam(m, static_cast<int>(p.type));
WriteParam(m, p.flags);
@@ -805,7 +828,7 @@ struct ParamTraits<IPC::LogData> {
WriteParam(m, p.dispatch);
WriteParam(m, p.params);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int type;
bool result =
ReadParam(m, iter, &r->channel) &&
@@ -826,9 +849,9 @@ struct ParamTraits<IPC::LogData> {
template <>
struct ParamTraits<Tuple0> {
typedef Tuple0 param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return true;
}
static void Log(const param_type& p, std::wstring* l) {
@@ -838,10 +861,10 @@ struct ParamTraits<Tuple0> {
template <class A>
struct ParamTraits< Tuple1<A> > {
typedef Tuple1<A> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return ReadParam(m, iter, &r->a);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -852,11 +875,11 @@ struct ParamTraits< Tuple1<A> > {
template <class A, class B>
struct ParamTraits< Tuple2<A, B> > {
typedef Tuple2<A, B> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
WriteParam(m, p.b);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b));
}
@@ -870,12 +893,12 @@ struct ParamTraits< Tuple2<A, B> > {
template <class A, class B, class C>
struct ParamTraits< Tuple3<A, B, C> > {
typedef Tuple3<A, B, C> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
WriteParam(m, p.b);
WriteParam(m, p.c);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b) &&
ReadParam(m, iter, &r->c));
@@ -892,13 +915,13 @@ struct ParamTraits< Tuple3<A, B, C> > {
template <class A, class B, class C, class D>
struct ParamTraits< Tuple4<A, B, C, D> > {
typedef Tuple4<A, B, C, D> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
WriteParam(m, p.b);
WriteParam(m, p.c);
WriteParam(m, p.d);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b) &&
ReadParam(m, iter, &r->c) &&
@@ -918,14 +941,14 @@ struct ParamTraits< Tuple4<A, B, C, D> > {
template <class A, class B, class C, class D, class E>
struct ParamTraits< Tuple5<A, B, C, D, E> > {
typedef Tuple5<A, B, C, D, E> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
WriteParam(m, p.b);
WriteParam(m, p.c);
WriteParam(m, p.d);
WriteParam(m, p.e);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b) &&
ReadParam(m, iter, &r->c) &&
@@ -948,7 +971,7 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > {
template <class A, class B, class C, class D, class E, class F>
struct ParamTraits< Tuple6<A, B, C, D, E, F> > {
typedef Tuple6<A, B, C, D, E, F> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.a);
WriteParam(m, p.b);
WriteParam(m, p.c);
@@ -956,7 +979,7 @@ struct ParamTraits< Tuple6<A, B, C, D, E, F> > {
WriteParam(m, p.e);
WriteParam(m, p.f);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b) &&
ReadParam(m, iter, &r->c) &&
@@ -982,77 +1005,11 @@ struct ParamTraits< Tuple6<A, B, C, D, E, F> > {
template <>
struct ParamTraits<webkit_glue::WebApplicationInfo> {
typedef webkit_glue::WebApplicationInfo param_type;
- static void Write(IPC::Message* m, const param_type& p);
- static bool Read(const IPC::Message* m, void** iter, param_type* r);
+ 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::wstring* l);
};
-// Traits for ViewMsg_FindInPageMsg_Request structure to pack/unpack.
-template <>
-struct ParamTraits<FindInPageRequest> {
- typedef FindInPageRequest param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.request_id);
- WriteParam(m, p.search_string);
- WriteParam(m, p.forward);
- WriteParam(m, p.match_case);
- WriteParam(m, p.find_next);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->request_id) &&
- ReadParam(m, iter, &p->search_string) &&
- ReadParam(m, iter, &p->forward) &&
- ReadParam(m, iter, &p->match_case) &&
- ReadParam(m, iter, &p->find_next);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<FindInPageRequest>");
- }
-};
-
-namespace IPC {
-
-//-----------------------------------------------------------------------------
-// An iterator class for reading the fields contained within a Message.
-
-class MessageIterator {
- public:
- explicit MessageIterator(const Message& m) : msg_(m), iter_(NULL) {
- }
- int NextInt() const {
- int val;
- if (!msg_.ReadInt(&iter_, &val))
- NOTREACHED();
- return val;
- }
- intptr_t NextIntPtr() const {
- intptr_t val;
- if (!msg_.ReadIntPtr(&iter_, &val))
- NOTREACHED();
- return val;
- }
- const std::string NextString() const {
- std::string val;
- if (!msg_.ReadString(&iter_, &val))
- NOTREACHED();
- return val;
- }
- const std::wstring NextWString() const {
- std::wstring val;
- if (!msg_.ReadWString(&iter_, &val))
- NOTREACHED();
- return val;
- }
- const void NextData(const char** data, int* length) const {
- if (!msg_.ReadData(&iter_, data, length)) {
- NOTREACHED();
- }
- }
- private:
- const Message& msg_;
- mutable void* iter_;
-};
//-----------------------------------------------------------------------------
// Generic message subclasses
@@ -1068,7 +1025,7 @@ class MessageWithTuple : public Message {
WriteParam(this, p);
}
- static bool Read(const IPC::Message* msg, Param* p) {
+ static bool Read(const Message* msg, Param* p) {
void* iter = NULL;
bool rv = ReadParam(msg, &iter, p);
DCHECK(rv) << "Error deserializing message " << msg->type();
@@ -1077,7 +1034,7 @@ class MessageWithTuple : public Message {
// Generic dispatcher. Should cover most cases.
template<class T, class Method>
- static bool Dispatch(const IPC::Message* msg, T* obj, Method func) {
+ static bool Dispatch(const Message* msg, T* obj, Method func) {
Param p;
if (Read(msg, &p)) {
DispatchToMethod(obj, func, p);
@@ -1090,7 +1047,7 @@ class MessageWithTuple : public Message {
// needs the message as well. They assume that "Param" is a type of Tuple
// (except the one arg case, as there is no Tuple1).
template<class T, typename TA>
- static bool Dispatch(const IPC::Message* msg, T* obj,
+ static bool Dispatch(const Message* msg, T* obj,
void (T::*func)(const Message&, TA)) {
Param p;
if (Read(msg, &p)) {
@@ -1101,7 +1058,7 @@ class MessageWithTuple : public Message {
}
template<class T, typename TA, typename TB>
- static bool Dispatch(const IPC::Message* msg, T* obj,
+ static bool Dispatch(const Message* msg, T* obj,
void (T::*func)(const Message&, TA, TB)) {
Param p;
if (Read(msg, &p)) {
@@ -1112,7 +1069,7 @@ class MessageWithTuple : public Message {
}
template<class T, typename TA, typename TB, typename TC>
- static bool Dispatch(const IPC::Message* msg, T* obj,
+ static bool Dispatch(const Message* msg, T* obj,
void (T::*func)(const Message&, TA, TB, TC)) {
Param p;
if (Read(msg, &p)) {
@@ -1123,7 +1080,7 @@ class MessageWithTuple : public Message {
}
template<class T, typename TA, typename TB, typename TC, typename TD>
- static bool Dispatch(const IPC::Message* msg, T* obj,
+ static bool Dispatch(const Message* msg, T* obj,
void (T::*func)(const Message&, TA, TB, TC, TD)) {
Param p;
if (Read(msg, &p)) {
@@ -1135,7 +1092,7 @@ class MessageWithTuple : public Message {
template<class T, typename TA, typename TB, typename TC, typename TD,
typename TE>
- static bool Dispatch(const IPC::Message* msg, T* obj,
+ static bool Dispatch(const Message* msg, T* obj,
void (T::*func)(const Message&, TA, TB, TC, TD, TE)) {
Param p;
if (Read(msg, &p)) {
@@ -1145,59 +1102,11 @@ class MessageWithTuple : public Message {
return false;
}
- static void Log(const IPC::Message* msg, std::wstring* l) {
+ static void Log(const Message* msg, std::wstring* l) {
Param p;
if (Read(msg, &p))
LogParam(p, l);
}
-
- // Functions used to do manual unpacking. Only used by the automation code,
- // these should go away once that code uses SyncChannel.
- template<typename TA, typename TB>
- static bool Read(const IPC::Message* msg, TA* a, TB* b) {
- ParamType params;
- if (!Read(msg, &params))
- return false;
- *a = params.a;
- *b = params.b;
- return true;
- }
-
- template<typename TA, typename TB, typename TC>
- static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c) {
- ParamType params;
- if (!Read(msg, &params))
- return false;
- *a = params.a;
- *b = params.b;
- *c = params.c;
- return true;
- }
-
- template<typename TA, typename TB, typename TC, typename TD>
- static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d) {
- ParamType params;
- if (!Read(msg, &params))
- return false;
- *a = params.a;
- *b = params.b;
- *c = params.c;
- *d = params.d;
- return true;
- }
-
- template<typename TA, typename TB, typename TC, typename TD, typename TE>
- static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d, TE* e) {
- ParamType params;
- if (!Read(msg, &params))
- return false;
- *a = params.a;
- *b = params.b;
- *c = params.c;
- *d = params.d;
- *e = params.e;
- return true;
- }
};
// This class assumes that its template argument is a RefTuple (a Tuple with
@@ -1229,7 +1138,7 @@ class MessageWithReply : public SyncMessage {
WriteParam(this, send);
}
- static void Log(const IPC::Message* msg, std::wstring* l) {
+ static void Log(const Message* msg, std::wstring* l) {
if (msg->is_sync()) {
SendParam p;
void* iter = SyncMessage::GetDataIterator(msg);
@@ -1254,7 +1163,7 @@ class MessageWithReply : public SyncMessage {
}
template<class T, class Method>
- static bool Dispatch(const IPC::Message* msg, T* obj, Method func) {
+ static bool Dispatch(const Message* msg, T* obj, Method func) {
SendParam send_params;
void* iter = GetDataIterator(msg);
Message* reply = GenerateReply(msg);
@@ -1282,7 +1191,7 @@ class MessageWithReply : public SyncMessage {
}
template<class T, class Method>
- static bool DispatchDelayReply(const IPC::Message* msg, T* obj, Method func) {
+ static bool DispatchDelayReply(const Message* msg, T* obj, Method func) {
SendParam send_params;
void* iter = GetDataIterator(msg);
Message* reply = GenerateReply(msg);
@@ -1343,6 +1252,32 @@ class MessageWithReply : public SyncMessage {
}
};
+// Traits for ViewMsg_FindInPageMsg_Request structure to pack/unpack.
+template <>
+struct ParamTraits<FindInPageRequest> {
+ typedef FindInPageRequest param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.request_id);
+ WriteParam(m, p.search_string);
+ WriteParam(m, p.forward);
+ WriteParam(m, p.match_case);
+ WriteParam(m, p.find_next);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->request_id) &&
+ ReadParam(m, iter, &p->search_string) &&
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->match_case) &&
+ ReadParam(m, iter, &p->find_next);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<FindInPageRequest>");
+ }
+};
+
+//-----------------------------------------------------------------------------
+
} // namespace IPC
#endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_
diff --git a/chrome/common/ipc_sync_channel_unittest.cc b/chrome/common/ipc_sync_channel_unittest.cc
index 2ccbd96..53d3f2a 100644
--- a/chrome/common/ipc_sync_channel_unittest.cc
+++ b/chrome/common/ipc_sync_channel_unittest.cc
@@ -20,9 +20,12 @@
#include "chrome/common/stl_util-inl.h"
#include "testing/gtest/include/gtest/gtest.h"
+#define IPC_MESSAGE_MACROS_ENUMS
+#include "chrome/common/ipc_sync_channel_unittest.h"
-#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
-#include "chrome/common/ipc_message_macros.h"
+// define the classes
+#define IPC_MESSAGE_MACROS_CLASSES
+#include "chrome/common/ipc_sync_channel_unittest.h"
using namespace IPC;
using base::WaitableEvent;
diff --git a/chrome/common/ipc_sync_message_unittest.cc b/chrome/common/ipc_sync_message_unittest.cc
index 6508eaf..ae44acb 100644
--- a/chrome/common/ipc_sync_message_unittest.cc
+++ b/chrome/common/ipc_sync_message_unittest.cc
@@ -14,9 +14,13 @@
#include "base/logging.h"
#include "testing/gtest/include/gtest/gtest.h"
+#define IPC_MESSAGE_MACROS_ENUMS
+#include "chrome/common/ipc_sync_message_unittest.h"
+
+// define the classes
+#define IPC_MESSAGE_MACROS_CLASSES
+#include "chrome/common/ipc_sync_message_unittest.h"
-#define MESSAGES_INTERNAL_FILE "chrome/common/ipc_sync_message_unittest.h"
-#include "chrome/common/ipc_message_macros.h"
static IPC::Message* g_reply;
diff --git a/chrome/common/ipc_sync_message_unittest.h b/chrome/common/ipc_sync_message_unittest.h
index 3b32c10..8393533 100644
--- a/chrome/common/ipc_sync_message_unittest.h
+++ b/chrome/common/ipc_sync_message_unittest.h
@@ -4,16 +4,7 @@
#include "chrome/common/ipc_message_macros.h"
-IPC_BEGIN_MESSAGES(Test)
- IPC_SYNC_MESSAGE_CONTROL0_0(SyncChannelTestMsg_NoArgs)
-
- IPC_SYNC_MESSAGE_CONTROL0_1(SyncChannelTestMsg_AnswerToLife,
- int /* answer */)
-
- IPC_SYNC_MESSAGE_CONTROL1_1(SyncChannelTestMsg_Double,
- int /* in */,
- int /* out */)
-
+IPC_BEGIN_MESSAGES(TestMsg, 8)
// out1 is false
IPC_SYNC_MESSAGE_CONTROL0_1(Msg_C_0_1, bool)
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 793dde3..025acc2 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -15,11 +15,14 @@
#include "base/gfx/rect.h"
#include "base/basictypes.h"
+#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
#include "googleurl/src/gurl.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/glue/npruntime_util.h"
+void PluginMessagesInit();
+
// Name prefix of the event handle when a message box is displayed.
#define kMessageBoxEventPrefix L"message_box_active"
@@ -35,11 +38,95 @@ struct PluginMsg_Init_Params {
HANDLE modal_dialog_event;
};
+struct PluginHostMsg_URLRequest_Params {
+ std::string method;
+ bool is_javascript_url;
+ std::string target;
+ std::vector<char> buffer;
+ bool is_file_data;
+ bool notify;
+ std::string url;
+ HANDLE notify_data;
+ bool popups_allowed;
+};
+
+struct PluginMsg_URLRequestReply_Params {
+ int resource_id;
+ std::string url;
+ bool notify_needed;
+ HANDLE notify_data;
+ HANDLE stream;
+};
+
+struct PluginMsg_PrintResponse_Params {
+ HANDLE shared_memory;
+ size_t size;
+};
+
+struct PluginMsg_DidReceiveResponseParams {
+ int id;
+ std::string mime_type;
+ std::string headers;
+ uint32 expected_length;
+ uint32 last_modified;
+ bool request_is_seekable;
+};
+
+struct NPIdentifier_Param {
+ NPIdentifier identifier;
+};
+
+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_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_OBJECT_POINTER,
+};
+
+struct NPVariant_Param {
+ NPVariant_ParamEnum type;
+ bool bool_value;
+ int int_value;
+ double double_value;
+ std::string string_value;
+ int npobject_routing_id;
+ void* npobject_pointer;
+};
+
+
+#define IPC_MESSAGE_MACROS_ENUMS
+#include "chrome/common/plugin_messages_internal.h"
+
+#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
+# undef IPC_MESSAGE_MACROS_LOG
+# define IPC_MESSAGE_MACROS_CLASSES
+
+# include "chrome/common/plugin_messages_internal.h"
+# define IPC_MESSAGE_MACROS_LOG
+# undef IPC_MESSAGE_MACROS_CLASSES
+
+# include "chrome/common/plugin_messages_internal.h"
+#else
+# define IPC_MESSAGE_MACROS_CLASSES
+# include "chrome/common/plugin_messages_internal.h"
+#endif
+
+namespace IPC {
+
// Traits for PluginMsg_Init_Params structure to pack/unpack.
template <>
struct ParamTraits<PluginMsg_Init_Params> {
typedef PluginMsg_Init_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.containing_window);
WriteParam(m, p.url);
DCHECK(p.arg_names.size() == p.arg_values.size());
@@ -48,7 +135,7 @@ struct ParamTraits<PluginMsg_Init_Params> {
WriteParam(m, p.load_manually);
WriteParam(m, p.modal_dialog_event);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->containing_window) &&
ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->arg_names) &&
@@ -73,23 +160,10 @@ struct ParamTraits<PluginMsg_Init_Params> {
}
};
-
-struct PluginHostMsg_URLRequest_Params {
- std::string method;
- bool is_javascript_url;
- std::string target;
- std::vector<char> buffer;
- bool is_file_data;
- bool notify;
- std::string url;
- HANDLE notify_data;
- bool popups_allowed;
-};
-
template <>
struct ParamTraits<PluginHostMsg_URLRequest_Params> {
typedef PluginHostMsg_URLRequest_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.method);
WriteParam(m, p.is_javascript_url);
WriteParam(m, p.target);
@@ -100,7 +174,7 @@ struct ParamTraits<PluginHostMsg_URLRequest_Params> {
WriteParam(m, p.notify_data);
WriteParam(m, p.popups_allowed);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->method) &&
ReadParam(m, iter, &p->is_javascript_url) &&
@@ -135,26 +209,17 @@ struct ParamTraits<PluginHostMsg_URLRequest_Params> {
}
};
-
-struct PluginMsg_URLRequestReply_Params {
- int resource_id;
- std::string url;
- bool notify_needed;
- HANDLE notify_data;
- HANDLE stream;
-};
-
template <>
struct ParamTraits<PluginMsg_URLRequestReply_Params> {
typedef PluginMsg_URLRequestReply_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.resource_id);
WriteParam(m, p.url);
WriteParam(m, p.notify_needed);
WriteParam(m, p.notify_data);
WriteParam(m, p.stream);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->resource_id) &&
ReadParam(m, iter, &p->url) &&
@@ -177,20 +242,14 @@ struct ParamTraits<PluginMsg_URLRequestReply_Params> {
}
};
-
-struct PluginMsg_PrintResponse_Params {
- HANDLE shared_memory;
- size_t size;
-};
-
template <>
struct ParamTraits<PluginMsg_PrintResponse_Params> {
typedef PluginMsg_PrintResponse_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.shared_memory);
WriteParam(m, p.size);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->shared_memory) &&
ReadParam(m, iter, &r->size);
@@ -199,20 +258,10 @@ struct ParamTraits<PluginMsg_PrintResponse_Params> {
}
};
-
-struct PluginMsg_DidReceiveResponseParams {
- int id;
- std::string mime_type;
- std::string headers;
- uint32 expected_length;
- uint32 last_modified;
- bool request_is_seekable;
-};
-
template <>
struct ParamTraits<PluginMsg_DidReceiveResponseParams> {
typedef PluginMsg_DidReceiveResponseParams param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.id);
WriteParam(m, p.mime_type);
WriteParam(m, p.headers);
@@ -220,7 +269,7 @@ struct ParamTraits<PluginMsg_DidReceiveResponseParams> {
WriteParam(m, p.last_modified);
WriteParam(m, p.request_is_seekable);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->id) &&
ReadParam(m, iter, &r->mime_type) &&
@@ -246,18 +295,97 @@ struct ParamTraits<PluginMsg_DidReceiveResponseParams> {
}
};
+template <>
+struct ParamTraits<NPEvent> {
+ typedef NPEvent param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteData(reinterpret_cast<const char*>(&p), sizeof(NPEvent));
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ const char *data;
+ int data_size = 0;
+ bool result = m->ReadData(iter, &data, &data_size);
+ if (!result || data_size != sizeof(NPEvent)) {
+ NOTREACHED();
+ return false;
+ }
-struct NPIdentifier_Param {
- NPIdentifier identifier;
+ memcpy(r, data, sizeof(NPEvent));
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring event, wparam, lparam;
+ lparam = StringPrintf(L"(%d, %d)", LOWORD(p.lParam), HIWORD(p.lParam));
+ switch(p.event) {
+ case WM_KEYDOWN:
+ event = L"WM_KEYDOWN";
+ wparam = StringPrintf(L"%d", p.wParam);
+ lparam = StringPrintf(L"%d", p.lParam);
+ break;
+ case WM_KEYUP:
+ event = L"WM_KEYDOWN";
+ wparam = StringPrintf(L"%d", p.wParam);
+ lparam = StringPrintf(L"%x", p.lParam);
+ break;
+ case WM_MOUSEMOVE:
+ event = L"WM_MOUSEMOVE";
+ if (p.wParam & MK_LBUTTON) {
+ wparam = L"MK_LBUTTON";
+ } else if (p.wParam & MK_MBUTTON) {
+ wparam = L"MK_MBUTTON";
+ } else if (p.wParam & MK_RBUTTON) {
+ wparam = L"MK_RBUTTON";
+ }
+ break;
+ case WM_LBUTTONDOWN:
+ event = L"WM_LBUTTONDOWN";
+ break;
+ case WM_MBUTTONDOWN:
+ event = L"WM_MBUTTONDOWN";
+ break;
+ case WM_RBUTTONDOWN:
+ event = L"WM_RBUTTONDOWN";
+ break;
+ case WM_LBUTTONUP:
+ event = L"WM_LBUTTONUP";
+ break;
+ case WM_MBUTTONUP:
+ event = L"WM_MBUTTONUP";
+ break;
+ case WM_RBUTTONUP:
+ event = L"WM_RBUTTONUP";
+ break;
+ }
+
+ if (p.wParam & MK_CONTROL) {
+ if (!wparam.empty())
+ wparam += L" ";
+ wparam += L"MK_CONTROL";
+ }
+
+ if (p.wParam & MK_SHIFT) {
+ if (!wparam.empty())
+ wparam += L" ";
+ wparam += L"MK_SHIFT";
+ }
+
+ l->append(L"(");
+ LogParam(event, l);
+ l->append(L", ");
+ LogParam(wparam, l);
+ l->append(L", ");
+ LogParam(lparam, l);
+ l->append(L")");
+ }
};
template <>
struct ParamTraits<NPIdentifier_Param> {
typedef NPIdentifier_Param param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
webkit_glue::SerializeNPIdentifier(p.identifier, m);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return webkit_glue::DeserializeNPIdentifier(*m, iter, &r->identifier);
}
static void Log(const param_type& p, std::wstring* l) {
@@ -271,37 +399,10 @@ struct ParamTraits<NPIdentifier_Param> {
}
};
-
-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_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_OBJECT_POINTER,
-};
-
-struct NPVariant_Param {
- NPVariant_ParamEnum type;
- bool bool_value;
- int int_value;
- double double_value;
- std::string string_value;
- int npobject_routing_id;
- void* npobject_pointer;
-};
-
template <>
struct ParamTraits<NPVariant_Param> {
typedef NPVariant_Param param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void 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);
@@ -324,7 +425,7 @@ struct ParamTraits<NPVariant_Param> {
DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL);
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int type;
if (!ReadParam(m, iter, &type))
return false;
@@ -372,94 +473,7 @@ struct ParamTraits<NPVariant_Param> {
}
};
-
-template <>
-struct ParamTraits<NPEvent> {
- typedef NPEvent param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- m->WriteData(reinterpret_cast<const char*>(&p), sizeof(NPEvent));
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
- const char *data;
- int data_size = 0;
- bool result = m->ReadData(iter, &data, &data_size);
- if (!result || data_size != sizeof(NPEvent)) {
- NOTREACHED();
- return false;
- }
-
- memcpy(r, data, sizeof(NPEvent));
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- std::wstring event, wparam, lparam;
- lparam = StringPrintf(L"(%d, %d)", LOWORD(p.lParam), HIWORD(p.lParam));
- switch(p.event) {
- case WM_KEYDOWN:
- event = L"WM_KEYDOWN";
- wparam = StringPrintf(L"%d", p.wParam);
- lparam = StringPrintf(L"%d", p.lParam);
- break;
- case WM_KEYUP:
- event = L"WM_KEYDOWN";
- wparam = StringPrintf(L"%d", p.wParam);
- lparam = StringPrintf(L"%x", p.lParam);
- break;
- case WM_MOUSEMOVE:
- event = L"WM_MOUSEMOVE";
- if (p.wParam & MK_LBUTTON) {
- wparam = L"MK_LBUTTON";
- } else if (p.wParam & MK_MBUTTON) {
- wparam = L"MK_MBUTTON";
- } else if (p.wParam & MK_RBUTTON) {
- wparam = L"MK_RBUTTON";
- }
- break;
- case WM_LBUTTONDOWN:
- event = L"WM_LBUTTONDOWN";
- break;
- case WM_MBUTTONDOWN:
- event = L"WM_MBUTTONDOWN";
- break;
- case WM_RBUTTONDOWN:
- event = L"WM_RBUTTONDOWN";
- break;
- case WM_LBUTTONUP:
- event = L"WM_LBUTTONUP";
- break;
- case WM_MBUTTONUP:
- event = L"WM_MBUTTONUP";
- break;
- case WM_RBUTTONUP:
- event = L"WM_RBUTTONUP";
- break;
- }
-
- if (p.wParam & MK_CONTROL) {
- if (!wparam.empty())
- wparam += L" ";
- wparam += L"MK_CONTROL";
- }
-
- if (p.wParam & MK_SHIFT) {
- if (!wparam.empty())
- wparam += L" ";
- wparam += L"MK_SHIFT";
- }
-
- l->append(L"(");
- LogParam(event, l);
- l->append(L", ");
- LogParam(wparam, l);
- l->append(L", ");
- LogParam(lparam, l);
- l->append(L")");
- }
-};
-
-
-#define MESSAGES_INTERNAL_FILE "chrome/common/plugin_messages_internal.h"
-#include "chrome/common/ipc_message_macros.h"
+} // namespace IPC
#endif // CHROME_COMMON_PLUGIN_MESSAGES_H__
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index d8561d0..85093d5 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -9,7 +9,7 @@
//-----------------------------------------------------------------------------
// PluginProcess messages
// These are messages sent from the browser to the plugin process.
-IPC_BEGIN_MESSAGES(PluginProcess)
+IPC_BEGIN_MESSAGES(PluginProcess, 3)
// Tells the plugin process to create a new channel for communication with a
// renderer. The channel name is returned in a
// PluginProcessHostMsg_ChannelCreated message.
@@ -35,7 +35,7 @@ IPC_END_MESSAGES(PluginProcess)
//-----------------------------------------------------------------------------
// PluginProcessHost messages
// These are messages sent from the plugin process to the browser process.
-IPC_BEGIN_MESSAGES(PluginProcessHost)
+IPC_BEGIN_MESSAGES(PluginProcessHost, 4)
// Response to a PluginProcessMsg_CreateChannel message.
IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_ChannelCreated,
int /* process_id */,
@@ -92,7 +92,7 @@ IPC_END_MESSAGES(PluginProcessHost)
//-----------------------------------------------------------------------------
// Plugin messages
// These are messages sent from the renderer process to the plugin process.
-IPC_BEGIN_MESSAGES(Plugin)
+IPC_BEGIN_MESSAGES(Plugin, 5)
// Tells the plugin process to create a new plugin instance with the given
// id. A corresponding WebPluginDelegateStub is created which hosts the
// WebPluginDelegateImpl.
@@ -202,7 +202,7 @@ IPC_END_MESSAGES(Plugin)
// PluginHost messages
// These are messages sent from the plugin process to the renderer process.
// They all map to the corresponding WebPlugin methods.
-IPC_BEGIN_MESSAGES(PluginHost)
+IPC_BEGIN_MESSAGES(PluginHost, 6)
// Sends the plugin window information to the renderer.
// The window parameter is a handle to the window if the plugin is a windowed
// plugin. It is NULL for windowless plugins.
@@ -274,7 +274,7 @@ IPC_END_MESSAGES(PluginHost)
// NPObject messages
// These are messages used to marshall NPObjects. They are sent both from the
// plugin to the renderer and from the renderer to the plugin.
-IPC_BEGIN_MESSAGES(NPObject)
+IPC_BEGIN_MESSAGES(NPObject, 7)
IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release)
IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod,
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index c33d63e..95c7e6d 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -15,6 +15,7 @@
#include "base/shared_memory.h"
#include "chrome/common/bitmap_wire_data.h"
#include "chrome/common/filter_policy.h"
+#include "chrome/common/ipc_message.h"
#include "chrome/common/ipc_message_utils.h"
#include "chrome/common/modal_dialog_event.h"
#include "chrome/common/page_transition_types.h"
@@ -30,7 +31,6 @@
#include "webkit/glue/resource_loader_bridge.h"
#include "webkit/glue/screen_info.h"
#include "webkit/glue/webdropdata.h"
-#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview_delegate.h"
@@ -66,43 +66,8 @@ struct ViewMsg_Navigate_Params {
bool reload;
};
-// Traits for ViewMsg_Navigate_Params structure to pack/unpack.
-template <>
-struct ParamTraits<ViewMsg_Navigate_Params> {
- typedef ViewMsg_Navigate_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.page_id);
- WriteParam(m, p.url);
- WriteParam(m, p.referrer);
- WriteParam(m, p.transition);
- WriteParam(m, p.state);
- WriteParam(m, p.reload);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->page_id) &&
- ReadParam(m, iter, &p->url) &&
- ReadParam(m, iter, &p->referrer) &&
- ReadParam(m, iter, &p->transition) &&
- ReadParam(m, iter, &p->state) &&
- ReadParam(m, iter, &p->reload);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.page_id, l);
- l->append(L", ");
- LogParam(p.url, l);
- l->append(L", ");
- LogParam(p.transition, l);
- l->append(L", ");
- LogParam(p.state, l);
- l->append(L", ");
- LogParam(p.reload, l);
- l->append(L")");
- }
-};
-
-
+// Parameters structure for ViewHostMsg_FrameNavigate, which has too many data
+// parameters to be reasonably put in a predefined IPC message.
struct ViewHostMsg_FrameNavigate_Params {
// Page ID of this navigation. The renderer creates a new unique page ID
// anytime a new session history entry is created. This means you'll get new
@@ -156,80 +121,8 @@ struct ViewHostMsg_FrameNavigate_Params {
bool is_content_filtered;
};
-template <>
-struct ParamTraits<ViewHostMsg_FrameNavigate_Params> {
- typedef ViewHostMsg_FrameNavigate_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.page_id);
- WriteParam(m, p.url);
- WriteParam(m, p.referrer);
- WriteParam(m, p.transition);
- WriteParam(m, p.redirects);
- WriteParam(m, p.should_update_history);
- WriteParam(m, p.searchable_form_url);
- WriteParam(m, p.searchable_form_element_name);
- WriteParam(m, p.searchable_form_encoding);
- WriteParam(m, p.password_form);
- WriteParam(m, p.security_info);
- WriteParam(m, p.gesture);
- WriteParam(m, p.contents_mime_type);
- WriteParam(m, p.is_post);
- WriteParam(m, p.is_content_filtered);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->page_id) &&
- ReadParam(m, iter, &p->url) &&
- ReadParam(m, iter, &p->referrer) &&
- ReadParam(m, iter, &p->transition) &&
- ReadParam(m, iter, &p->redirects) &&
- ReadParam(m, iter, &p->should_update_history) &&
- ReadParam(m, iter, &p->searchable_form_url) &&
- ReadParam(m, iter, &p->searchable_form_element_name) &&
- ReadParam(m, iter, &p->searchable_form_encoding) &&
- ReadParam(m, iter, &p->password_form) &&
- ReadParam(m, iter, &p->security_info) &&
- ReadParam(m, iter, &p->gesture) &&
- ReadParam(m, iter, &p->contents_mime_type) &&
- ReadParam(m, iter, &p->is_post) &&
- ReadParam(m, iter, &p->is_content_filtered);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.page_id, l);
- l->append(L", ");
- LogParam(p.url, l);
- l->append(L", ");
- LogParam(p.referrer, l);
- l->append(L", ");
- LogParam(p.transition, l);
- l->append(L", ");
- LogParam(p.redirects, l);
- l->append(L", ");
- LogParam(p.should_update_history, l);
- l->append(L", ");
- LogParam(p.searchable_form_url, l);
- l->append(L", ");
- LogParam(p.searchable_form_element_name, l);
- l->append(L", ");
- LogParam(p.searchable_form_encoding, l);
- l->append(L", ");
- LogParam(p.password_form, l);
- l->append(L", ");
- LogParam(p.security_info, l);
- l->append(L", ");
- LogParam(p.gesture, l);
- l->append(L", ");
- LogParam(p.contents_mime_type, l);
- l->append(L", ");
- LogParam(p.is_post, l);
- l->append(L", ");
- LogParam(p.is_content_filtered, l);
- l->append(L")");
- }
-};
-
-
+// Parameters structure for ViewHostMsg_ContextMenu, which has too many data
+// parameters to be reasonably put in a predefined IPC message.
// FIXME(beng): This would be more useful in the future and more efficient
// if the parameters here weren't so literally mapped to what
// they contain for the ContextMenu task. It might be better
@@ -283,45 +176,6 @@ struct ViewHostMsg_ContextMenu_Params {
std::string security_info;
};
-template <>
-struct ParamTraits<ViewHostMsg_ContextMenu_Params> {
- typedef ViewHostMsg_ContextMenu_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.node);
- WriteParam(m, p.x);
- WriteParam(m, p.y);
- WriteParam(m, p.link_url);
- WriteParam(m, p.image_url);
- WriteParam(m, p.page_url);
- WriteParam(m, p.frame_url);
- WriteParam(m, p.selection_text);
- WriteParam(m, p.misspelled_word);
- WriteParam(m, p.dictionary_suggestions);
- WriteParam(m, p.spellcheck_enabled);
- WriteParam(m, p.edit_flags);
- WriteParam(m, p.security_info);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->node) &&
- ReadParam(m, iter, &p->x) &&
- ReadParam(m, iter, &p->y) &&
- ReadParam(m, iter, &p->link_url) &&
- ReadParam(m, iter, &p->image_url) &&
- ReadParam(m, iter, &p->page_url) &&
- ReadParam(m, iter, &p->frame_url) &&
- ReadParam(m, iter, &p->selection_text) &&
- ReadParam(m, iter, &p->misspelled_word) &&
- ReadParam(m, iter, &p->dictionary_suggestions) &&
- ReadParam(m, iter, &p->spellcheck_enabled) &&
- ReadParam(m, iter, &p->edit_flags) &&
- ReadParam(m, iter, &p->security_info);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewHostMsg_ContextMenu_Params>");
- }
-};
-
// Values that may be OR'd together to form the 'flags' parameter of a
// ViewHostMsg_PaintRect message.
struct ViewHostMsg_PaintRect_Flags {
@@ -373,40 +227,8 @@ struct ViewHostMsg_PaintRect_Params {
int flags;
};
-template <>
-struct ParamTraits<ViewHostMsg_PaintRect_Params> {
- typedef ViewHostMsg_PaintRect_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.bitmap);
- WriteParam(m, p.bitmap_rect);
- WriteParam(m, p.view_size);
- WriteParam(m, p.plugin_window_moves);
- WriteParam(m, p.flags);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->bitmap) &&
- ReadParam(m, iter, &p->bitmap_rect) &&
- ReadParam(m, iter, &p->view_size) &&
- ReadParam(m, iter, &p->plugin_window_moves) &&
- ReadParam(m, iter, &p->flags);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.bitmap, l);
- l->append(L", ");
- LogParam(p.bitmap_rect, l);
- l->append(L", ");
- LogParam(p.view_size, l);
- l->append(L", ");
- LogParam(p.plugin_window_moves, l);
- l->append(L", ");
- LogParam(p.flags, l);
- l->append(L")");
- }
-};
-
-
+// Parameters structure for ViewHostMsg_ScrollRect, which has too many data
+// parameters to be reasonably put in a predefined IPC message.
struct ViewHostMsg_ScrollRect_Params {
// The bitmap to be painted into the rect exposed by scrolling.
BitmapWireData bitmap;
@@ -428,48 +250,7 @@ struct ViewHostMsg_ScrollRect_Params {
std::vector<WebPluginGeometry> plugin_window_moves;
};
-template <>
-struct ParamTraits<ViewHostMsg_ScrollRect_Params> {
- typedef ViewHostMsg_ScrollRect_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.bitmap);
- WriteParam(m, p.bitmap_rect);
- WriteParam(m, p.dx);
- WriteParam(m, p.dy);
- WriteParam(m, p.clip_rect);
- WriteParam(m, p.view_size);
- WriteParam(m, p.plugin_window_moves);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->bitmap) &&
- ReadParam(m, iter, &p->bitmap_rect) &&
- ReadParam(m, iter, &p->dx) &&
- ReadParam(m, iter, &p->dy) &&
- ReadParam(m, iter, &p->clip_rect) &&
- ReadParam(m, iter, &p->view_size) &&
- ReadParam(m, iter, &p->plugin_window_moves);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.bitmap, l);
- l->append(L", ");
- LogParam(p.bitmap_rect, l);
- l->append(L", ");
- LogParam(p.dx, l);
- l->append(L", ");
- LogParam(p.dy, l);
- l->append(L", ");
- LogParam(p.clip_rect, l);
- l->append(L", ");
- LogParam(p.view_size, l);
- l->append(L", ");
- LogParam(p.plugin_window_moves, l);
- l->append(L")");
- }
-};
-
-
+// Parameters structure for ViewMsg_UploadFile.
struct ViewMsg_UploadFile_Params {
// See WebContents::StartFileUpload for a description of these fields.
std::wstring file_path;
@@ -479,30 +260,7 @@ struct ViewMsg_UploadFile_Params {
std::wstring other_values;
};
-template <>
-struct ParamTraits<ViewMsg_UploadFile_Params> {
- typedef ViewMsg_UploadFile_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.file_path);
- WriteParam(m, p.form);
- WriteParam(m, p.file);
- WriteParam(m, p.submit);
- WriteParam(m, p.other_values);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->file_path) &&
- ReadParam(m, iter, &p->form) &&
- ReadParam(m, iter, &p->file) &&
- ReadParam(m, iter, &p->submit) &&
- ReadParam(m, iter, &p->other_values);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewMsg_UploadFile_Params>");
- }
-};
-
-
+// Parameters for a resource request.
struct ViewHostMsg_Resource_Request {
// The request method: GET, POST, etc.
std::string method;
@@ -544,58 +302,7 @@ struct ViewHostMsg_Resource_Request {
std::vector<net::UploadData::Element> upload_content;
};
-template <>
-struct ParamTraits<ViewHostMsg_Resource_Request> {
- typedef ViewHostMsg_Resource_Request param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.method);
- WriteParam(m, p.url);
- WriteParam(m, p.policy_url);
- WriteParam(m, p.referrer);
- WriteParam(m, p.headers);
- WriteParam(m, p.load_flags);
- WriteParam(m, p.origin_pid);
- WriteParam(m, p.resource_type);
- WriteParam(m, p.mixed_content);
- WriteParam(m, p.request_context);
- WriteParam(m, p.upload_content);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->method) &&
- ReadParam(m, iter, &r->url) &&
- ReadParam(m, iter, &r->policy_url) &&
- ReadParam(m, iter, &r->referrer) &&
- ReadParam(m, iter, &r->headers) &&
- ReadParam(m, iter, &r->load_flags) &&
- ReadParam(m, iter, &r->origin_pid) &&
- ReadParam(m, iter, &r->resource_type) &&
- ReadParam(m, iter, &r->mixed_content) &&
- ReadParam(m, iter, &r->request_context) &&
- ReadParam(m, iter, &r->upload_content);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.method, l);
- l->append(L", ");
- LogParam(p.url, l);
- l->append(L", ");
- LogParam(p.referrer, l);
- l->append(L", ");
- LogParam(p.load_flags, l);
- l->append(L", ");
- LogParam(p.origin_pid, l);
- l->append(L", ");
- LogParam(p.resource_type, l);
- l->append(L", ");
- LogParam(p.mixed_content, l);
- l->append(L", ");
- LogParam(p.request_context, l);
- l->append(L")");
- }
-};
-
-
+// Parameters for a resource response header.
struct ViewMsg_Resource_ResponseHead
: webkit_glue::ResourceLoaderBridge::ResponseInfo {
// The response status.
@@ -606,66 +313,7 @@ struct ViewMsg_Resource_ResponseHead
FilterPolicy::Type filter_policy;
};
-template <>
-struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> {
- typedef webkit_glue::ResourceLoaderBridge::ResponseInfo param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.request_time);
- WriteParam(m, p.response_time);
- WriteParam(m, p.headers);
- WriteParam(m, p.mime_type);
- WriteParam(m, p.charset);
- WriteParam(m, p.security_info);
- WriteParam(m, p.content_length);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->request_time) &&
- ReadParam(m, iter, &r->response_time) &&
- ReadParam(m, iter, &r->headers) &&
- ReadParam(m, iter, &r->mime_type) &&
- ReadParam(m, iter, &r->charset) &&
- ReadParam(m, iter, &r->security_info) &&
- ReadParam(m, iter, &r->content_length);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.request_time, l);
- l->append(L", ");
- LogParam(p.response_time, l);
- l->append(L", ");
- LogParam(p.headers, l);
- l->append(L", ");
- LogParam(p.mime_type, l);
- l->append(L", ");
- LogParam(p.charset, l);
- l->append(L", ");
- LogParam(p.security_info, l);
- l->append(L")");
- }
-};
-
-template <>
-struct ParamTraits<ViewMsg_Resource_ResponseHead> {
- typedef ViewMsg_Resource_ResponseHead param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Write(m, p);
- WriteParam(m, p.status);
- WriteParam(m, p.filter_policy);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
- return
- ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Read(m, iter, r) &&
- ReadParam(m, iter, &r->status) &&
- ReadParam(m, iter, &r->filter_policy);
- }
- static void Log(const param_type& p, std::wstring* l) {
- // log more?
- ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l);
- }
-};
-
-
+// Parameters for a synchronous resource response.
struct ViewHostMsg_SyncLoad_Result : ViewMsg_Resource_ResponseHead {
// The final URL after any redirects.
GURL final_url;
@@ -674,27 +322,7 @@ struct ViewHostMsg_SyncLoad_Result : ViewMsg_Resource_ResponseHead {
std::string data;
};
-template <>
-struct ParamTraits<ViewHostMsg_SyncLoad_Result> {
- typedef ViewHostMsg_SyncLoad_Result param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- ParamTraits<ViewMsg_Resource_ResponseHead>::Write(m, p);
- WriteParam(m, p.final_url);
- WriteParam(m, p.data);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
- return
- ParamTraits<ViewMsg_Resource_ResponseHead>::Read(m, iter, r) &&
- ReadParam(m, iter, &r->final_url) &&
- ReadParam(m, iter, &r->data);
- }
- static void Log(const param_type& p, std::wstring* l) {
- // log more?
- ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l);
- }
-};
-
-
+// Parameters for a render request.
struct ViewMsg_Print_Params {
// In pixels according to dpi_x and dpi_y.
gfx::Size printable_size;
@@ -724,31 +352,6 @@ struct ViewMsg_Print_Params {
}
};
-template <>
-struct ParamTraits<ViewMsg_Print_Params> {
- typedef ViewMsg_Print_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.printable_size);
- WriteParam(m, p.dpi);
- WriteParam(m, p.min_shrink);
- WriteParam(m, p.max_shrink);
- WriteParam(m, p.desired_dpi);
- WriteParam(m, p.document_cookie);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->printable_size) &&
- ReadParam(m, iter, &p->dpi) &&
- ReadParam(m, iter, &p->min_shrink) &&
- ReadParam(m, iter, &p->max_shrink) &&
- ReadParam(m, iter, &p->desired_dpi) &&
- ReadParam(m, iter, &p->document_cookie);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewMsg_Print_Params>");
- }
-};
-
-
struct ViewMsg_PrintPage_Params {
// Parameters to render the page as a printed page. It must always be the same
// value for all the document.
@@ -759,23 +362,6 @@ struct ViewMsg_PrintPage_Params {
int page_number;
};
-template <>
-struct ParamTraits<ViewMsg_PrintPage_Params> {
- typedef ViewMsg_PrintPage_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.params);
- WriteParam(m, p.page_number);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->params) &&
- ReadParam(m, iter, &p->page_number);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewMsg_PrintPage_Params>");
- }
-};
-
-
struct ViewMsg_PrintPages_Params {
// Parameters to render the page as a printed page. It must always be the same
// value for all the document.
@@ -785,23 +371,6 @@ struct ViewMsg_PrintPages_Params {
std::vector<int> pages;
};
-template <>
-struct ParamTraits<ViewMsg_PrintPages_Params> {
- typedef ViewMsg_PrintPages_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.params);
- WriteParam(m, p.pages);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->params) &&
- ReadParam(m, iter, &p->pages);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewMsg_PrintPages_Params>");
- }
-};
-
-
// Parameters to describe a rendered page.
struct ViewHostMsg_DidPrintPage_Params {
// A shared memory handle to the EMF data. This data can be quite large so a
@@ -821,29 +390,6 @@ struct ViewHostMsg_DidPrintPage_Params {
double actual_shrink;
};
-template <>
-struct ParamTraits<ViewHostMsg_DidPrintPage_Params> {
- typedef ViewHostMsg_DidPrintPage_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.emf_data_handle);
- WriteParam(m, p.data_size);
- WriteParam(m, p.document_cookie);
- WriteParam(m, p.page_number);
- WriteParam(m, p.actual_shrink);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return ReadParam(m, iter, &p->emf_data_handle) &&
- ReadParam(m, iter, &p->data_size) &&
- ReadParam(m, iter, &p->document_cookie) &&
- ReadParam(m, iter, &p->page_number) &&
- ReadParam(m, iter, &p->actual_shrink);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<ViewHostMsg_DidPrintPage_Params>");
- }
-};
-
-
// Parameters structure to hold a union of the possible IAccessible function
// INPUT variables, with the unused fields always set to default value. Used in
// ViewMsg_GetAccessibilityInfo, as only parameter.
@@ -864,40 +410,6 @@ struct ViewMsg_Accessibility_In_Params {
long input_long2;
};
-template <>
-struct ParamTraits<ViewMsg_Accessibility_In_Params> {
- typedef ViewMsg_Accessibility_In_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.iaccessible_id);
- WriteParam(m, p.iaccessible_function_id);
- WriteParam(m, p.input_variant_lval);
- WriteParam(m, p.input_long1);
- WriteParam(m, p.input_long2);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->iaccessible_id) &&
- ReadParam(m, iter, &p->iaccessible_function_id) &&
- ReadParam(m, iter, &p->input_variant_lval) &&
- ReadParam(m, iter, &p->input_long1) &&
- ReadParam(m, iter, &p->input_long2);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.iaccessible_id, l);
- l->append(L", ");
- LogParam(p.iaccessible_function_id, l);
- l->append(L", ");
- LogParam(p.input_variant_lval, l);
- l->append(L", ");
- LogParam(p.input_long1, l);
- l->append(L", ");
- LogParam(p.input_long2, l);
- l->append(L")");
- }
-};
-
-
// Parameters structure to hold a union of the possible IAccessible function
// OUTPUT variables, with the unused fields always set to default value. Used in
// ViewHostMsg_GetAccessibilityInfoResponse, as only parameter.
@@ -927,52 +439,6 @@ struct ViewHostMsg_Accessibility_Out_Params {
bool return_code;
};
-template <>
-struct ParamTraits<ViewHostMsg_Accessibility_Out_Params> {
- typedef ViewHostMsg_Accessibility_Out_Params param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- WriteParam(m, p.iaccessible_id);
- WriteParam(m, p.output_variant_lval);
- WriteParam(m, p.output_long1);
- WriteParam(m, p.output_long2);
- WriteParam(m, p.output_long3);
- WriteParam(m, p.output_long4);
- WriteParam(m, p.output_string);
- WriteParam(m, p.return_code);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->iaccessible_id) &&
- ReadParam(m, iter, &p->output_variant_lval) &&
- ReadParam(m, iter, &p->output_long1) &&
- ReadParam(m, iter, &p->output_long2) &&
- ReadParam(m, iter, &p->output_long3) &&
- ReadParam(m, iter, &p->output_long4) &&
- ReadParam(m, iter, &p->output_string) &&
- ReadParam(m, iter, &p->return_code);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.iaccessible_id, l);
- l->append(L", ");
- LogParam(p.output_variant_lval, l);
- l->append(L", ");
- LogParam(p.output_long1, l);
- l->append(L", ");
- LogParam(p.output_long2, l);
- l->append(L", ");
- LogParam(p.output_long3, l);
- l->append(L", ");
- LogParam(p.output_long4, l);
- l->append(L", ");
- LogParam(p.output_string, l);
- l->append(L", ");
- LogParam(p.return_code, l);
- l->append(L")");
- }
-};
-
-
// The first parameter for the ViewHostMsg_ImeUpdateStatus message.
enum ViewHostMsg_ImeControl {
IME_DISABLE = 0,
@@ -980,49 +446,38 @@ enum ViewHostMsg_ImeControl {
IME_COMPLETE_COMPOSITION,
};
-template <>
-struct ParamTraits<ViewHostMsg_ImeControl> {
- typedef ViewHostMsg_ImeControl param_type;
- static void Write(IPC::Message* m, const param_type& p) {
- m->WriteInt(p);
- }
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
- int type;
- if (!m->ReadInt(iter, &type))
- return false;
- *p = static_cast<ViewHostMsg_ImeControl>(type);
- return true;
- }
- static void Log(const param_type& p, std::wstring* l) {
- std::wstring control;
- switch (p) {
- case IME_DISABLE:
- control = L"IME_DISABLE";
- break;
- case IME_MOVE_WINDOWS:
- control = L"IME_MOVE_WINDOWS";
- break;
- case IME_COMPLETE_COMPOSITION:
- control = L"IME_COMPLETE_COMPOSITION";
- break;
- default:
- control = L"UNKNOWN";
- break;
- }
+// Multi-pass include of render_messages_internal. Preprocessor magic allows
+// us to use 1 header to define the enums and classes for our render messages.
+#define IPC_MESSAGE_MACROS_ENUMS
+#include "chrome/common/render_messages_internal.h"
+
+#ifdef IPC_MESSAGE_MACROS_LOG_ENABLED
+// When we are supposed to create debug strings, we run it through twice, once
+// with debug strings on, and once with only CLASSES on to generate both types
+// of messages.
+# undef IPC_MESSAGE_MACROS_LOG
+# define IPC_MESSAGE_MACROS_CLASSES
+# include "chrome/common/render_messages_internal.h"
+
+# undef IPC_MESSAGE_MACROS_CLASSES
+# define IPC_MESSAGE_MACROS_LOG
+# include "chrome/common/render_messages_internal.h"
+#else
+// No debug strings requested, just define the classes
+# define IPC_MESSAGE_MACROS_CLASSES
+# include "chrome/common/render_messages_internal.h"
+#endif
- LogParam(control, l);
- }
-};
+namespace IPC {
-// These traits are for structures that are defined outside of this file.
template <>
struct ParamTraits<ResourceType::Type> {
typedef ResourceType::Type param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type))
return false;
@@ -1056,10 +511,10 @@ struct ParamTraits<ResourceType::Type> {
template <>
struct ParamTraits<FilterPolicy::Type> {
typedef FilterPolicy::Type param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type) || !FilterPolicy::ValidType(type))
return false;
@@ -1090,10 +545,10 @@ struct ParamTraits<FilterPolicy::Type> {
template <>
struct ParamTraits<ContextNode> {
typedef ContextNode param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p.type);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
@@ -1131,10 +586,10 @@ struct ParamTraits<ContextNode> {
template <>
struct ParamTraits<WebInputEvent::Type> {
typedef WebInputEvent::Type param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
@@ -1177,10 +632,161 @@ struct ParamTraits<WebInputEvent::Type> {
}
};
+// Traits for ViewMsg_Accessibility_In_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewMsg_Accessibility_In_Params> {
+ typedef ViewMsg_Accessibility_In_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.iaccessible_id);
+ WriteParam(m, p.iaccessible_function_id);
+ WriteParam(m, p.input_variant_lval);
+ WriteParam(m, p.input_long1);
+ WriteParam(m, p.input_long2);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->iaccessible_id) &&
+ ReadParam(m, iter, &p->iaccessible_function_id) &&
+ ReadParam(m, iter, &p->input_variant_lval) &&
+ ReadParam(m, iter, &p->input_long1) &&
+ ReadParam(m, iter, &p->input_long2);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.iaccessible_id, l);
+ l->append(L", ");
+ LogParam(p.iaccessible_function_id, l);
+ l->append(L", ");
+ LogParam(p.input_variant_lval, l);
+ l->append(L", ");
+ LogParam(p.input_long1, l);
+ l->append(L", ");
+ LogParam(p.input_long2, l);
+ l->append(L")");
+ }
+};
+
+// Traits for ViewHostMsg_Accessibility_Out_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_Accessibility_Out_Params> {
+ typedef ViewHostMsg_Accessibility_Out_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.iaccessible_id);
+ WriteParam(m, p.output_variant_lval);
+ WriteParam(m, p.output_long1);
+ WriteParam(m, p.output_long2);
+ WriteParam(m, p.output_long3);
+ WriteParam(m, p.output_long4);
+ WriteParam(m, p.output_string);
+ WriteParam(m, p.return_code);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->iaccessible_id) &&
+ ReadParam(m, iter, &p->output_variant_lval) &&
+ ReadParam(m, iter, &p->output_long1) &&
+ ReadParam(m, iter, &p->output_long2) &&
+ ReadParam(m, iter, &p->output_long3) &&
+ ReadParam(m, iter, &p->output_long4) &&
+ ReadParam(m, iter, &p->output_string) &&
+ ReadParam(m, iter, &p->return_code);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.iaccessible_id, l);
+ l->append(L", ");
+ LogParam(p.output_variant_lval, l);
+ l->append(L", ");
+ LogParam(p.output_long1, l);
+ l->append(L", ");
+ LogParam(p.output_long2, l);
+ l->append(L", ");
+ LogParam(p.output_long3, l);
+ l->append(L", ");
+ LogParam(p.output_long4, l);
+ l->append(L", ");
+ LogParam(p.output_string, l);
+ l->append(L", ");
+ LogParam(p.return_code, l);
+ l->append(L")");
+ }
+};
+
+template <>
+struct ParamTraits<ViewHostMsg_ImeControl> {
+ typedef ViewHostMsg_ImeControl 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<ViewHostMsg_ImeControl>(type);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ std::wstring control;
+ switch (p) {
+ case IME_DISABLE:
+ control = L"IME_DISABLE";
+ break;
+ case IME_MOVE_WINDOWS:
+ control = L"IME_MOVE_WINDOWS";
+ break;
+ case IME_COMPLETE_COMPOSITION:
+ control = L"IME_COMPLETE_COMPOSITION";
+ break;
+ default:
+ control = L"UNKNOWN";
+ break;
+ }
+
+ LogParam(control, l);
+ }
+};
+
+// Traits for ViewMsg_Navigate_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewMsg_Navigate_Params> {
+ typedef ViewMsg_Navigate_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.page_id);
+ WriteParam(m, p.url);
+ WriteParam(m, p.referrer);
+ WriteParam(m, p.transition);
+ WriteParam(m, p.state);
+ WriteParam(m, p.reload);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->page_id) &&
+ ReadParam(m, iter, &p->url) &&
+ ReadParam(m, iter, &p->referrer) &&
+ ReadParam(m, iter, &p->transition) &&
+ ReadParam(m, iter, &p->state) &&
+ ReadParam(m, iter, &p->reload);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.page_id, l);
+ l->append(L", ");
+ LogParam(p.url, l);
+ l->append(L", ");
+ LogParam(p.transition, l);
+ l->append(L", ");
+ LogParam(p.state, l);
+ l->append(L", ");
+ LogParam(p.reload, l);
+ l->append(L")");
+ }
+};
+
+// Traits for PasswordForm_Params structure to pack/unpack.
template <>
struct ParamTraits<PasswordForm> {
typedef PasswordForm param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.signon_realm);
WriteParam(m, p.origin);
WriteParam(m, p.action);
@@ -1195,7 +801,7 @@ struct ParamTraits<PasswordForm> {
WriteParam(m, p.preferred);
WriteParam(m, p.blacklisted_by_user);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->signon_realm) &&
ReadParam(m, iter, &p->origin) &&
@@ -1216,10 +822,11 @@ struct ParamTraits<PasswordForm> {
}
};
+// Traits for AutofillForm_Params structure to pack/unpack.
template <>
struct ParamTraits<AutofillForm> {
typedef AutofillForm param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.elements.size());
for (std::vector<AutofillForm::Element>::const_iterator itr =
p.elements.begin();
@@ -1229,7 +836,7 @@ struct ParamTraits<AutofillForm> {
WriteParam(m, itr->value);
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
bool result = true;
size_t elements_size = 0;
result = result && ReadParam(m, iter, &elements_size);
@@ -1246,18 +853,207 @@ struct ParamTraits<AutofillForm> {
}
};
+// Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_FrameNavigate_Params> {
+ typedef ViewHostMsg_FrameNavigate_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.page_id);
+ WriteParam(m, p.url);
+ WriteParam(m, p.referrer);
+ WriteParam(m, p.transition);
+ WriteParam(m, p.redirects);
+ WriteParam(m, p.should_update_history);
+ WriteParam(m, p.searchable_form_url);
+ WriteParam(m, p.searchable_form_element_name);
+ WriteParam(m, p.searchable_form_encoding);
+ WriteParam(m, p.password_form);
+ WriteParam(m, p.security_info);
+ WriteParam(m, p.gesture);
+ WriteParam(m, p.contents_mime_type);
+ WriteParam(m, p.is_post);
+ WriteParam(m, p.is_content_filtered);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->page_id) &&
+ ReadParam(m, iter, &p->url) &&
+ ReadParam(m, iter, &p->referrer) &&
+ ReadParam(m, iter, &p->transition) &&
+ ReadParam(m, iter, &p->redirects) &&
+ ReadParam(m, iter, &p->should_update_history) &&
+ ReadParam(m, iter, &p->searchable_form_url) &&
+ ReadParam(m, iter, &p->searchable_form_element_name) &&
+ ReadParam(m, iter, &p->searchable_form_encoding) &&
+ ReadParam(m, iter, &p->password_form) &&
+ ReadParam(m, iter, &p->security_info) &&
+ ReadParam(m, iter, &p->gesture) &&
+ ReadParam(m, iter, &p->contents_mime_type) &&
+ ReadParam(m, iter, &p->is_post) &&
+ ReadParam(m, iter, &p->is_content_filtered);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.page_id, l);
+ l->append(L", ");
+ LogParam(p.url, l);
+ l->append(L", ");
+ LogParam(p.referrer, l);
+ l->append(L", ");
+ LogParam(p.transition, l);
+ l->append(L", ");
+ LogParam(p.redirects, l);
+ l->append(L", ");
+ LogParam(p.should_update_history, l);
+ l->append(L", ");
+ LogParam(p.searchable_form_url, l);
+ l->append(L", ");
+ LogParam(p.searchable_form_element_name, l);
+ l->append(L", ");
+ LogParam(p.searchable_form_encoding, l);
+ l->append(L", ");
+ LogParam(p.password_form, l);
+ l->append(L", ");
+ LogParam(p.security_info, l);
+ l->append(L", ");
+ LogParam(p.gesture, l);
+ l->append(L", ");
+ LogParam(p.contents_mime_type, l);
+ l->append(L", ");
+ LogParam(p.is_post, l);
+ l->append(L", ");
+ LogParam(p.is_content_filtered, l);
+ l->append(L")");
+ }
+};
+
+// Traits for ViewHostMsg_ContextMenu_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_ContextMenu_Params> {
+ typedef ViewHostMsg_ContextMenu_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.node);
+ WriteParam(m, p.x);
+ WriteParam(m, p.y);
+ WriteParam(m, p.link_url);
+ WriteParam(m, p.image_url);
+ WriteParam(m, p.page_url);
+ WriteParam(m, p.frame_url);
+ WriteParam(m, p.selection_text);
+ WriteParam(m, p.misspelled_word);
+ WriteParam(m, p.dictionary_suggestions);
+ WriteParam(m, p.spellcheck_enabled);
+ WriteParam(m, p.edit_flags);
+ WriteParam(m, p.security_info);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->node) &&
+ ReadParam(m, iter, &p->x) &&
+ ReadParam(m, iter, &p->y) &&
+ ReadParam(m, iter, &p->link_url) &&
+ ReadParam(m, iter, &p->image_url) &&
+ ReadParam(m, iter, &p->page_url) &&
+ ReadParam(m, iter, &p->frame_url) &&
+ ReadParam(m, iter, &p->selection_text) &&
+ ReadParam(m, iter, &p->misspelled_word) &&
+ ReadParam(m, iter, &p->dictionary_suggestions) &&
+ ReadParam(m, iter, &p->spellcheck_enabled) &&
+ ReadParam(m, iter, &p->edit_flags) &&
+ ReadParam(m, iter, &p->security_info);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewHostMsg_ContextMenu_Params>");
+ }
+};
+
+// Traits for ViewHostMsg_PaintRect_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_PaintRect_Params> {
+ typedef ViewHostMsg_PaintRect_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.bitmap);
+ WriteParam(m, p.bitmap_rect);
+ WriteParam(m, p.view_size);
+ WriteParam(m, p.plugin_window_moves);
+ WriteParam(m, p.flags);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->bitmap) &&
+ ReadParam(m, iter, &p->bitmap_rect) &&
+ ReadParam(m, iter, &p->view_size) &&
+ ReadParam(m, iter, &p->plugin_window_moves) &&
+ ReadParam(m, iter, &p->flags);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.bitmap, l);
+ l->append(L", ");
+ LogParam(p.bitmap_rect, l);
+ l->append(L", ");
+ LogParam(p.view_size, l);
+ l->append(L", ");
+ LogParam(p.plugin_window_moves, l);
+ l->append(L", ");
+ LogParam(p.flags, l);
+ l->append(L")");
+ }
+};
+
+// Traits for ViewHostMsg_ScrollRect_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewHostMsg_ScrollRect_Params> {
+ typedef ViewHostMsg_ScrollRect_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.bitmap);
+ WriteParam(m, p.bitmap_rect);
+ WriteParam(m, p.dx);
+ WriteParam(m, p.dy);
+ WriteParam(m, p.clip_rect);
+ WriteParam(m, p.view_size);
+ WriteParam(m, p.plugin_window_moves);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->bitmap) &&
+ ReadParam(m, iter, &p->bitmap_rect) &&
+ ReadParam(m, iter, &p->dx) &&
+ ReadParam(m, iter, &p->dy) &&
+ ReadParam(m, iter, &p->clip_rect) &&
+ ReadParam(m, iter, &p->view_size) &&
+ ReadParam(m, iter, &p->plugin_window_moves);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.bitmap, l);
+ l->append(L", ");
+ LogParam(p.bitmap_rect, l);
+ l->append(L", ");
+ LogParam(p.dx, l);
+ l->append(L", ");
+ LogParam(p.dy, l);
+ l->append(L", ");
+ LogParam(p.clip_rect, l);
+ l->append(L", ");
+ LogParam(p.view_size, l);
+ l->append(L", ");
+ LogParam(p.plugin_window_moves, l);
+ l->append(L")");
+ }
+};
template <>
struct ParamTraits<WebPluginGeometry> {
typedef WebPluginGeometry param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.window);
WriteParam(m, p.window_rect);
WriteParam(m, p.clip_rect);
WriteParam(m, p.cutout_rects);
WriteParam(m, p.visible);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->window) &&
ReadParam(m, iter, &p->window_rect) &&
@@ -1280,16 +1076,16 @@ struct ParamTraits<WebPluginGeometry> {
}
};
-
+// Traits for ViewMsg_GetPlugins_Reply structure to pack/unpack.
template <>
struct ParamTraits<WebPluginMimeType> {
typedef WebPluginMimeType param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.mime_type);
WriteParam(m, p.file_extensions);
WriteParam(m, p.description);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->mime_type) &&
ReadParam(m, iter, &r->file_extensions) &&
@@ -1310,14 +1106,14 @@ struct ParamTraits<WebPluginMimeType> {
template <>
struct ParamTraits<WebPluginInfo> {
typedef WebPluginInfo param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void 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);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->name) &&
ReadParam(m, iter, &r->path) &&
@@ -1341,10 +1137,35 @@ struct ParamTraits<WebPluginInfo> {
}
};
+// Traits for ViewMsg_UploadFile_Params structure to pack/unpack.
+template <>
+struct ParamTraits<ViewMsg_UploadFile_Params> {
+ typedef ViewMsg_UploadFile_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.file_path);
+ WriteParam(m, p.form);
+ WriteParam(m, p.file);
+ WriteParam(m, p.submit);
+ WriteParam(m, p.other_values);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->file_path) &&
+ ReadParam(m, iter, &p->form) &&
+ ReadParam(m, iter, &p->file) &&
+ ReadParam(m, iter, &p->submit) &&
+ ReadParam(m, iter, &p->other_values);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewMsg_UploadFile_Params>");
+ }
+};
+
+// Traits for net::UploadData::Element.
template <>
struct ParamTraits<net::UploadData::Element> {
typedef net::UploadData::Element param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.type()));
if (p.type() == net::UploadData::TYPE_BYTES) {
m->WriteData(&p.bytes()[0], static_cast<int>(p.bytes().size()));
@@ -1354,7 +1175,7 @@ struct ParamTraits<net::UploadData::Element> {
WriteParam(m, p.file_range_length());
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int type;
if (!ReadParam(m, iter, &type))
return false;
@@ -1383,17 +1204,18 @@ struct ParamTraits<net::UploadData::Element> {
}
};
+// Traits for CacheManager::UsageStats
template <>
struct ParamTraits<CacheManager::UsageStats> {
typedef CacheManager::UsageStats param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.min_dead_capacity);
WriteParam(m, p.max_dead_capacity);
WriteParam(m, p.capacity);
WriteParam(m, p.live_size);
WriteParam(m, p.dead_size);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->min_dead_capacity) &&
ReadParam(m, iter, &r->max_dead_capacity) &&
@@ -1406,15 +1228,16 @@ struct ParamTraits<CacheManager::UsageStats> {
}
};
+// Traits for PasswordFormDomManager::FillData.
template <>
struct ParamTraits<PasswordFormDomManager::FillData> {
typedef PasswordFormDomManager::FillData param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.basic_data);
WriteParam(m, p.additional_logins);
WriteParam(m, p.wait_for_username);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
return
ReadParam(m, iter, &r->basic_data) &&
ReadParam(m, iter, &r->additional_logins) &&
@@ -1428,10 +1251,10 @@ struct ParamTraits<PasswordFormDomManager::FillData> {
template<>
struct ParamTraits<NavigationGesture> {
typedef NavigationGesture param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
m->WriteInt(p);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
int type;
if (!m->ReadInt(iter, &type))
return false;
@@ -1455,14 +1278,67 @@ struct ParamTraits<NavigationGesture> {
}
};
+// Traits for ViewHostMsg_Resource_Request
+template <>
+struct ParamTraits<ViewHostMsg_Resource_Request> {
+ typedef ViewHostMsg_Resource_Request param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.method);
+ WriteParam(m, p.url);
+ WriteParam(m, p.policy_url);
+ WriteParam(m, p.referrer);
+ WriteParam(m, p.headers);
+ WriteParam(m, p.load_flags);
+ WriteParam(m, p.origin_pid);
+ WriteParam(m, p.resource_type);
+ WriteParam(m, p.mixed_content);
+ WriteParam(m, p.request_context);
+ WriteParam(m, p.upload_content);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ReadParam(m, iter, &r->method) &&
+ ReadParam(m, iter, &r->url) &&
+ ReadParam(m, iter, &r->policy_url) &&
+ ReadParam(m, iter, &r->referrer) &&
+ ReadParam(m, iter, &r->headers) &&
+ ReadParam(m, iter, &r->load_flags) &&
+ ReadParam(m, iter, &r->origin_pid) &&
+ ReadParam(m, iter, &r->resource_type) &&
+ ReadParam(m, iter, &r->mixed_content) &&
+ ReadParam(m, iter, &r->request_context) &&
+ ReadParam(m, iter, &r->upload_content);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.method, l);
+ l->append(L", ");
+ LogParam(p.url, l);
+ l->append(L", ");
+ LogParam(p.referrer, l);
+ l->append(L", ");
+ LogParam(p.load_flags, l);
+ l->append(L", ");
+ LogParam(p.origin_pid, l);
+ l->append(L", ");
+ LogParam(p.resource_type, l);
+ l->append(L", ");
+ LogParam(p.mixed_content, l);
+ l->append(L", ");
+ LogParam(p.request_context, l);
+ l->append(L")");
+ }
+};
+
+// Traits for URLRequestStatus
template <>
struct ParamTraits<URLRequestStatus> {
typedef URLRequestStatus param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, static_cast<int>(p.status()));
WriteParam(m, p.os_error());
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
int status, os_error;
if (!ReadParam(m, iter, &status) ||
!ReadParam(m, iter, &os_error))
@@ -1509,14 +1385,14 @@ struct ParamTraits<URLRequestStatus> {
template <>
struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > {
typedef scoped_refptr<net::HttpResponseHeaders> param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void 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);
}
}
- static bool Read(const IPC::Message* m, void** iter, param_type* r) {
+ static bool Read(const Message* m, void** iter, param_type* r) {
bool has_object;
if (!ReadParam(m, iter, &has_object))
return false;
@@ -1529,17 +1405,100 @@ struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > {
}
};
+// Traits for webkit_glue::ResourceLoaderBridge::ResponseInfo
+template <>
+struct ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo> {
+ typedef webkit_glue::ResourceLoaderBridge::ResponseInfo param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.request_time);
+ WriteParam(m, p.response_time);
+ WriteParam(m, p.headers);
+ WriteParam(m, p.mime_type);
+ WriteParam(m, p.charset);
+ WriteParam(m, p.security_info);
+ WriteParam(m, p.content_length);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ReadParam(m, iter, &r->request_time) &&
+ ReadParam(m, iter, &r->response_time) &&
+ ReadParam(m, iter, &r->headers) &&
+ ReadParam(m, iter, &r->mime_type) &&
+ ReadParam(m, iter, &r->charset) &&
+ ReadParam(m, iter, &r->security_info) &&
+ ReadParam(m, iter, &r->content_length);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.request_time, l);
+ l->append(L", ");
+ LogParam(p.response_time, l);
+ l->append(L", ");
+ LogParam(p.headers, l);
+ l->append(L", ");
+ LogParam(p.mime_type, l);
+ l->append(L", ");
+ LogParam(p.charset, l);
+ l->append(L", ");
+ LogParam(p.security_info, l);
+ l->append(L")");
+ }
+};
+
+// Traits for ViewMsg_Resource_ResponseHead
+template <>
+struct ParamTraits<ViewMsg_Resource_ResponseHead> {
+ typedef ViewMsg_Resource_ResponseHead param_type;
+ static void Write(Message* m, const param_type& p) {
+ ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Write(m, p);
+ WriteParam(m, p.status);
+ WriteParam(m, p.filter_policy);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Read(m, iter, r) &&
+ ReadParam(m, iter, &r->status) &&
+ ReadParam(m, iter, &r->filter_policy);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ // log more?
+ ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l);
+ }
+};
+
+// Traits for ViewHostMsg_Resource_SyncLoad_Response
+template <>
+struct ParamTraits<ViewHostMsg_SyncLoad_Result> {
+ typedef ViewHostMsg_SyncLoad_Result param_type;
+ static void Write(Message* m, const param_type& p) {
+ ParamTraits<ViewMsg_Resource_ResponseHead>::Write(m, p);
+ WriteParam(m, p.final_url);
+ WriteParam(m, p.data);
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ return
+ ParamTraits<ViewMsg_Resource_ResponseHead>::Read(m, iter, r) &&
+ ReadParam(m, iter, &r->final_url) &&
+ ReadParam(m, iter, &r->data);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ // log more?
+ ParamTraits<webkit_glue::ResourceLoaderBridge::ResponseInfo>::Log(p, l);
+ }
+};
+
+// Traits for FormData structure to pack/unpack.
template <>
struct ParamTraits<FormData> {
typedef FormData param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.origin);
WriteParam(m, p.action);
WriteParam(m, p.elements);
WriteParam(m, p.values);
WriteParam(m, p.submit);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->origin) &&
ReadParam(m, iter, &p->action) &&
@@ -1552,10 +1511,93 @@ struct ParamTraits<FormData> {
}
};
+// Traits for ViewMsg_Print_Params
+template <>
+struct ParamTraits<ViewMsg_Print_Params> {
+ typedef ViewMsg_Print_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.printable_size);
+ WriteParam(m, p.dpi);
+ WriteParam(m, p.min_shrink);
+ WriteParam(m, p.max_shrink);
+ WriteParam(m, p.desired_dpi);
+ WriteParam(m, p.document_cookie);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->printable_size) &&
+ ReadParam(m, iter, &p->dpi) &&
+ ReadParam(m, iter, &p->min_shrink) &&
+ ReadParam(m, iter, &p->max_shrink) &&
+ ReadParam(m, iter, &p->desired_dpi) &&
+ ReadParam(m, iter, &p->document_cookie);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewMsg_Print_Params>");
+ }
+};
+
+// Traits for ViewMsg_PrintPage_Params
+template <>
+struct ParamTraits<ViewMsg_PrintPage_Params> {
+ typedef ViewMsg_PrintPage_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.params);
+ WriteParam(m, p.page_number);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->params) &&
+ ReadParam(m, iter, &p->page_number);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewMsg_PrintPage_Params>");
+ }
+};
+
+// Traits for ViewMsg_PrintPages_Params
+template <>
+struct ParamTraits<ViewMsg_PrintPages_Params> {
+ typedef ViewMsg_PrintPages_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.params);
+ WriteParam(m, p.pages);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->params) &&
+ ReadParam(m, iter, &p->pages);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewMsg_PrintPages_Params>");
+ }
+};
+
+// Traits for ViewHostMsg_DidPrintPage_Params
+template <>
+struct ParamTraits<ViewHostMsg_DidPrintPage_Params> {
+ typedef ViewHostMsg_DidPrintPage_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.emf_data_handle);
+ WriteParam(m, p.data_size);
+ WriteParam(m, p.document_cookie);
+ WriteParam(m, p.page_number);
+ WriteParam(m, p.actual_shrink);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ return ReadParam(m, iter, &p->emf_data_handle) &&
+ ReadParam(m, iter, &p->data_size) &&
+ ReadParam(m, iter, &p->document_cookie) &&
+ ReadParam(m, iter, &p->page_number) &&
+ ReadParam(m, iter, &p->actual_shrink);
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<ViewHostMsg_DidPrintPage_Params>");
+ }
+};
+
+// Traits for WebPreferences structure to pack/unpack.
template <>
struct ParamTraits<WebPreferences> {
typedef WebPreferences param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.standard_font_family);
WriteParam(m, p.fixed_font_family);
WriteParam(m, p.serif_font_family);
@@ -1581,7 +1623,7 @@ struct ParamTraits<WebPreferences> {
WriteParam(m, p.user_style_sheet_location);
WriteParam(m, p.uses_page_cache);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->standard_font_family) &&
ReadParam(m, iter, &p->fixed_font_family) &&
@@ -1613,10 +1655,11 @@ struct ParamTraits<WebPreferences> {
}
};
+// Traits for WebDropData
template <>
struct ParamTraits<WebDropData> {
typedef WebDropData param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.url);
WriteParam(m, p.url_title);
WriteParam(m, p.file_extension);
@@ -1627,7 +1670,7 @@ struct ParamTraits<WebDropData> {
WriteParam(m, p.file_description_filename);
WriteParam(m, p.file_contents);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->url_title) &&
@@ -1644,17 +1687,18 @@ struct ParamTraits<WebDropData> {
}
};
+// Traits for ScreenInfo
template <>
struct ParamTraits<webkit_glue::ScreenInfo> {
typedef webkit_glue::ScreenInfo param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.depth);
WriteParam(m, p.depth_per_component);
WriteParam(m, p.is_monochrome);
WriteParam(m, p.rect);
WriteParam(m, p.available_rect);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return
ReadParam(m, iter, &p->depth) &&
ReadParam(m, iter, &p->depth_per_component) &&
@@ -1671,16 +1715,16 @@ template<>
struct ParamTraits<ModalDialogEvent> {
typedef ModalDialogEvent param_type;
#if defined(OS_WIN)
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
WriteParam(m, p.event);
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->event);
}
#else
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
return true;
}
#endif
@@ -1698,11 +1742,11 @@ struct ParamTraits<ModalDialogEvent> {
template <>
struct ParamTraits<gfx::NativeView> {
typedef gfx::NativeView param_type;
- static void Write(IPC::Message* m, const param_type& p) {
+ static void Write(Message* m, const param_type& p) {
NOTIMPLEMENTED();
}
- static bool Read(const IPC::Message* m, void** iter, param_type* p) {
+ static bool Read(const Message* m, void** iter, param_type* p) {
NOTIMPLEMENTED();
*p = NULL;
return true;
@@ -1715,8 +1759,6 @@ struct ParamTraits<gfx::NativeView> {
#endif // defined(OS_POSIX)
-
-#define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h"
-#include "chrome/common/ipc_message_macros.h"
+} // namespace IPC
#endif // CHROME_COMMON_RENDER_MESSAGES_H_
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 30c23ba..149dd53 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -25,6 +25,8 @@
#include "webkit/glue/webinputevent.h"
#include "webkit/glue/webplugin.h"
+void RenderMessagesInit();
+
// TODO(mpcomplete): rename ViewMsg and ViewHostMsg to something that makes
// more sense with our current design.
@@ -32,7 +34,7 @@
// RenderView messages
// These are messages sent from the browser to the renderer process.
-IPC_BEGIN_MESSAGES(View)
+IPC_BEGIN_MESSAGES(View, 1)
// Used typically when recovering from a crash. The new rendering process
// sets its global "next page id" counter to the given value.
IPC_MESSAGE_CONTROL1(ViewMsg_SetNextPageID,
@@ -484,7 +486,7 @@ IPC_END_MESSAGES(View)
// WebContents messages
// These are messages sent from the renderer to the browser process.
-IPC_BEGIN_MESSAGES(ViewHost)
+IPC_BEGIN_MESSAGES(ViewHost, 2)
// Sent by the renderer when it is creating a new window. The browser creates
// a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is
// MSG_ROUTING_NONE, the view couldn't be created. modal_dialog_event is set
@@ -736,11 +738,9 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC_MESSAGE_CONTROL3(ViewHostMsg_PageContents, GURL, int32, std::wstring)
// Specifies the URL as the first parameter (a wstring) and thumbnail as
- // binary data as the second parameter.
- IPC_MESSAGE_ROUTED3(ViewHostMsg_Thumbnail,
- GURL /* url */,
- ThumbnailScore /* score */,
- SkBitmap /* bitmap */)
+ // binary data as the second parameter. Our macros don't handle binary data,
+ // so this is declared "empty," to be encoded by the caller/receiver.
+ IPC_MESSAGE_EMPTY(ViewHostMsg_Thumbnail)
// Notification that the url for the favicon of a site has been determined.
IPC_MESSAGE_ROUTED2(ViewHostMsg_UpdateFavIconURL,
diff --git a/chrome/common/resource_bundle.h b/chrome/common/resource_bundle.h
index 54d99b2..7af3ac8 100644
--- a/chrome/common/resource_bundle.h
+++ b/chrome/common/resource_bundle.h
@@ -119,9 +119,6 @@ class ResourceBundle {
#elif defined(OS_LINUX)
// Linux will use base::DataPack. TODO(evanm): finish this.
typedef base::DataPack* DataHandle;
-#elif defined(OS_MACOSX)
- // TODO(port): figure this out
- typedef void* DataHandle;
#endif
// Ctor/dtor are private, since we're a singleton.
diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc
index 48cb178..bf9cc51 100644
--- a/chrome/common/resource_dispatcher_unittest.cc
+++ b/chrome/common/resource_dispatcher_unittest.cc
@@ -84,10 +84,10 @@ class ResourceDispatcherTest : public testing::Test,
void* iter = NULL;
int request_id;
- ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request_id));
+ ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_id));
ViewHostMsg_Resource_Request request;
- ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request));
+ ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request));
// check values
EXPECT_EQ(test_page_url, request.url.spec());
@@ -119,7 +119,7 @@ class ResourceDispatcherTest : public testing::Test,
// read the ack message.
iter = NULL;
int request_ack = -1;
- ASSERT_TRUE(ReadParam(&message_queue_[0], &iter, &request_ack));
+ ASSERT_TRUE(IPC::ReadParam(&message_queue_[0], &iter, &request_ack));
ASSERT_EQ(request_ack, request_id);
diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h
index ef08426..ef19b71 100644
--- a/chrome/common/security_filter_peer.h
+++ b/chrome/common/security_filter_peer.h
@@ -6,7 +6,7 @@
#ifndef CHROME_COMMON_SECURITY_FILTER_PEER_H__
#define CHROME_COMMON_SECURITY_FILTER_PEER_H__
-#include "chrome/common/filter_policy.h"
+#include "chrome/common/render_messages.h"
#include "webkit/glue/resource_loader_bridge.h"
// The SecurityFilterPeer is a proxy to a
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 350e29c..09ba200 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -16,7 +16,6 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
-#include "base/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
#include "chrome/browser/bookmarks/bookmark_service.h"
#include "chrome/browser/browser_process.h"
@@ -27,12 +26,12 @@
#include "chrome/common/navigation_types.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/page_transition_types.h"
+#include "chrome/common/render_messages.h"
#include "googleurl/src/gurl.h"
#include "skia/include/SkBitmap.h"
#include "webkit/glue/password_form.h"
#include "webkit/glue/window_open_disposition.h"
-class AutofillForm;
class Browser;
class BookmarkService;
class CommandLine;
@@ -61,7 +60,6 @@ class URLRequestContext;
class UserScriptMaster;
class VisitedLinkMaster;
class WebContents;
-class WebPreferences;
namespace IPC {
class Message;
@@ -293,8 +291,7 @@ class BrokerServices {
class IconManager {
};
-struct ViewHostMsg_DidPrintPage_Params;
-struct ViewHostMsg_FrameNavigate_Params;
+struct ViewHostMsg_Resource_Request;
class ResourceDispatcherHost {
public:
@@ -630,7 +627,7 @@ class RenderViewHost : public RenderWidgetHost {
return true;
}
void SetAlternateErrorPageURL(const GURL&) { NOTIMPLEMENTED(); }
- void UpdateWebPreferences(const WebPreferences&) { NOTIMPLEMENTED(); }
+ void UpdateWebPreferences(WebPreferences) { NOTIMPLEMENTED(); }
void ReservePageIDRange(int) { NOTIMPLEMENTED(); }
};