summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 17:36:32 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 17:36:32 +0000
commit1c99edc8d48f94702ac085197779ea22b820549b (patch)
treedbcb2aa6714c5769a5a0c134011e90b104603144 /chrome
parent4fd3c1a3faa42ee98f95e5f03182a597dea17196 (diff)
downloadchromium_src-1c99edc8d48f94702ac085197779ea22b820549b.zip
chromium_src-1c99edc8d48f94702ac085197779ea22b820549b.tar.gz
chromium_src-1c99edc8d48f94702ac085197779ea22b820549b.tar.bz2
Reapplies r55735, fixing some message code that was checked in that I collided with.
BUG=51411 TEST=none TBR=mpcomplete Review URL: http://codereview.chromium.org/3118009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55749 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/renderer_host/resource_message_filter_win.cc1
-rw-r--r--chrome/chrome_common.gypi1
-rw-r--r--chrome/common/render_messages.cc63
-rw-r--r--chrome/common/render_messages.h59
-rw-r--r--chrome/common/render_messages_unittest.cc2
-rw-r--r--chrome/common/webkit_param_traits.cc131
-rw-r--r--chrome/common/webkit_param_traits.h118
-rw-r--r--chrome/renderer/render_view.cc2
8 files changed, 227 insertions, 150 deletions
diff --git a/chrome/browser/renderer_host/resource_message_filter_win.cc b/chrome/browser/renderer_host/resource_message_filter_win.cc
index aa53422..4a8c46e 100644
--- a/chrome/browser/renderer_host/resource_message_filter_win.cc
+++ b/chrome/browser/renderer_host/resource_message_filter_win.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/common/render_messages.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h"
using WebKit::WebScreenInfo;
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index c60359f..28135c5c3 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -286,6 +286,7 @@
'common/visitedlink_common.h',
'common/web_database_observer_impl.cc',
'common/web_database_observer_impl.h',
+ 'common/webkit_param_traits.cc',
'common/webkit_param_traits.h',
'common/webmessageportchannel_impl.cc',
'common/webmessageportchannel_impl.h',
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc
index 68aa81d..04a258c 100644
--- a/chrome/common/render_messages.cc
+++ b/chrome/common/render_messages.cc
@@ -5,8 +5,71 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/thumbnail_score.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
+#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/webcursor.h"
#define MESSAGES_INTERNAL_IMPL_FILE \
"chrome/common/render_messages_internal.h"
#include "ipc/ipc_message_impl_macros.h"
+
+namespace IPC {
+
+void ParamTraits<webkit_glue::WebAccessibility>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.id);
+ WriteParam(m, p.name);
+ WriteParam(m, p.value);
+ WriteParam(m, static_cast<int>(p.role));
+ WriteParam(m, static_cast<int>(p.state));
+ WriteParam(m, p.location);
+ WriteParam(m, p.attributes);
+ WriteParam(m, p.children);
+}
+
+bool ParamTraits<webkit_glue::WebAccessibility>::Read(
+ const Message* m, void** iter, param_type* p) {
+ bool ret = ReadParam(m, iter, &p->id);
+ ret = ret && ReadParam(m, iter, &p->name);
+ ret = ret && ReadParam(m, iter, &p->value);
+ int role = -1;
+ ret = ret && ReadParam(m, iter, &role);
+ if (role >= webkit_glue::WebAccessibility::ROLE_NONE &&
+ role < webkit_glue::WebAccessibility::NUM_ROLES) {
+ p->role = static_cast<webkit_glue::WebAccessibility::Role>(role);
+ } else {
+ p->role = webkit_glue::WebAccessibility::ROLE_NONE;
+ }
+ int state = 0;
+ ret = ret && ReadParam(m, iter, &state);
+ p->state = static_cast<webkit_glue::WebAccessibility::State>(state);
+ ret = ret && ReadParam(m, iter, &p->location);
+ ret = ret && ReadParam(m, iter, &p->attributes);
+ ret = ret && ReadParam(m, iter, &p->children);
+ return ret;
+}
+
+void ParamTraits<webkit_glue::WebAccessibility>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.id, l);
+ l->append(L", ");
+ LogParam(p.name, l);
+ l->append(L", ");
+ LogParam(p.value, l);
+ l->append(L", ");
+ LogParam(static_cast<int>(p.role), l);
+ l->append(L", ");
+ LogParam(static_cast<int>(p.state), l);
+ l->append(L", ");
+ LogParam(p.location, l);
+ l->append(L", ");
+ LogParam(p.attributes, l);
+ l->append(L", ");
+ LogParam(p.children, l);
+ l->append(L")");
+}
+
+} // namespace IPC
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index e45d79d..00db777 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -52,7 +52,6 @@
#include "webkit/glue/plugins/webplugin.h"
#include "webkit/glue/plugins/webplugininfo.h"
#include "webkit/glue/resource_loader_bridge.h"
-#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/webcookie.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webmenuitem.h"
@@ -62,6 +61,10 @@ namespace base {
class Time;
}
+namespace webkit_glue {
+struct WebAccessibility;
+}
+
class SkBitmap;
// Parameters structure for ViewMsg_Navigate, which has too many data
@@ -3315,62 +3318,16 @@ struct ParamTraits<WindowContainerType> {
return true;
}
static void Log(const param_type& p, std::wstring* l) {
- LogParam(p, l);
+ ParamTraits<int>::Log(static_cast<int>(p), l);
}
};
template <>
struct ParamTraits<webkit_glue::WebAccessibility> {
typedef webkit_glue::WebAccessibility param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.id);
- WriteParam(m, p.name);
- WriteParam(m, p.value);
- WriteParam(m, static_cast<int>(p.role));
- WriteParam(m, static_cast<int>(p.state));
- WriteParam(m, p.location);
- WriteParam(m, p.attributes);
- WriteParam(m, p.children);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- bool ret = ReadParam(m, iter, &p->id);
- ret = ret && ReadParam(m, iter, &p->name);
- ret = ret && ReadParam(m, iter, &p->value);
- int role = -1;
- ret = ret && ReadParam(m, iter, &role);
- if (role >= webkit_glue::WebAccessibility::ROLE_NONE &&
- role < webkit_glue::WebAccessibility::NUM_ROLES) {
- p->role = static_cast<webkit_glue::WebAccessibility::Role>(role);
- } else {
- p->role = webkit_glue::WebAccessibility::ROLE_NONE;
- }
- int state = 0;
- ret = ret && ReadParam(m, iter, &state);
- p->state = static_cast<webkit_glue::WebAccessibility::State>(state);
- ret = ret && ReadParam(m, iter, &p->location);
- ret = ret && ReadParam(m, iter, &p->attributes);
- ret = ret && ReadParam(m, iter, &p->children);
- return ret;
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.id, l);
- l->append(L", ");
- LogParam(p.name, l);
- l->append(L", ");
- LogParam(p.value, l);
- l->append(L", ");
- LogParam(static_cast<int>(p.role), l);
- l->append(L", ");
- LogParam(static_cast<int>(p.state), l);
- l->append(L", ");
- LogParam(p.location, l);
- l->append(L", ");
- LogParam(p.attributes, l);
- l->append(L", ");
- LogParam(p.children, l);
- l->append(L")");
- }
+ 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);
};
// Traits for ViewMsg_DeviceOrientationUpdated_Params
diff --git a/chrome/common/render_messages_unittest.cc b/chrome/common/render_messages_unittest.cc
index ccfc898..4fc0aab 100644
--- a/chrome/common/render_messages_unittest.cc
+++ b/chrome/common/render_messages_unittest.cc
@@ -7,6 +7,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/render_messages.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/glue/webaccessibility.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
TEST(RenderMessagesUnittest, WebAccessibility) {
// Test a simple case.
diff --git a/chrome/common/webkit_param_traits.cc b/chrome/common/webkit_param_traits.cc
new file mode 100644
index 0000000..06ee1e2
--- /dev/null
+++ b/chrome/common/webkit_param_traits.cc
@@ -0,0 +1,131 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/webkit_param_traits.h"
+
+#include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
+
+namespace IPC {
+
+void ParamTraits<WebKit::WebRect>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.x);
+ WriteParam(m, p.y);
+ WriteParam(m, p.width);
+ WriteParam(m, p.height);
+ }
+
+bool ParamTraits<WebKit::WebRect>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->x) &&
+ ReadParam(m, iter, &p->y) &&
+ ReadParam(m, iter, &p->width) &&
+ ReadParam(m, iter, &p->height);
+}
+
+void ParamTraits<WebKit::WebRect>::Log(const param_type& p, std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.x, l);
+ l->append(L", ");
+ LogParam(p.y, l);
+ l->append(L", ");
+ LogParam(p.width, l);
+ l->append(L", ");
+ LogParam(p.height, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebScreenInfo>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.depth);
+ WriteParam(m, p.depthPerComponent);
+ WriteParam(m, p.isMonochrome);
+ WriteParam(m, p.rect);
+ WriteParam(m, p.availableRect);
+}
+
+bool ParamTraits<WebKit::WebScreenInfo>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->depth) &&
+ ReadParam(m, iter, &p->depthPerComponent) &&
+ ReadParam(m, iter, &p->isMonochrome) &&
+ ReadParam(m, iter, &p->rect) &&
+ ReadParam(m, iter, &p->availableRect);
+}
+
+void ParamTraits<WebKit::WebScreenInfo>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.depth, l);
+ l->append(L", ");
+ LogParam(p.depthPerComponent, l);
+ l->append(L", ");
+ LogParam(p.isMonochrome, l);
+ l->append(L", ");
+ LogParam(p.rect, l);
+ l->append(L", ");
+ LogParam(p.availableRect, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebFindOptions>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.forward);
+ WriteParam(m, p.matchCase);
+ WriteParam(m, p.findNext);
+}
+
+bool ParamTraits<WebKit::WebFindOptions>::Read(const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->forward) &&
+ ReadParam(m, iter, &p->matchCase) &&
+ ReadParam(m, iter, &p->findNext);
+}
+
+void ParamTraits<WebKit::WebFindOptions>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.forward, l);
+ l->append(L", ");
+ LogParam(p.matchCase, l);
+ l->append(L", ");
+ LogParam(p.findNext, l);
+ l->append(L")");
+}
+
+void ParamTraits<WebKit::WebCompositionUnderline>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.startOffset);
+ WriteParam(m, p.endOffset);
+ WriteParam(m, p.color);
+ WriteParam(m, p.thick);
+}
+
+bool ParamTraits<WebKit::WebCompositionUnderline>::Read(
+ const Message* m, void** iter,
+ param_type* p) {
+ return
+ ReadParam(m, iter, &p->startOffset) &&
+ ReadParam(m, iter, &p->endOffset) &&
+ ReadParam(m, iter, &p->color) &&
+ ReadParam(m, iter, &p->thick);
+}
+
+void ParamTraits<WebKit::WebCompositionUnderline>::Log(const param_type& p,
+ std::wstring* l) {
+ l->append(L"(");
+ LogParam(p.startOffset, l);
+ l->append(L",");
+ LogParam(p.endOffset, l);
+ l->append(L":");
+ LogParam(p.color, l);
+ l->append(L":");
+ LogParam(p.thick, l);
+ l->append(L")");
+}
+
+} // namespace IPC
diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h
index 748c26b..4b0433a 100644
--- a/chrome/common/webkit_param_traits.h
+++ b/chrome/common/webkit_param_traits.h
@@ -26,80 +26,38 @@
#include "ipc/ipc_message_utils.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCache.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
#include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
-#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h"
#include "third_party/WebKit/WebKit/chromium/public/WebTextInputType.h"
+namespace WebKit {
+struct WebCompositionUnderline;
+struct WebFindOptions;
+struct WebRect;
+struct WebScreenInfo;
+}
+
namespace IPC {
template <>
struct ParamTraits<WebKit::WebRect> {
typedef WebKit::WebRect param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.x);
- WriteParam(m, p.y);
- WriteParam(m, p.width);
- WriteParam(m, p.height);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->x) &&
- ReadParam(m, iter, &p->y) &&
- ReadParam(m, iter, &p->width) &&
- ReadParam(m, iter, &p->height);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.x, l);
- l->append(L", ");
- LogParam(p.y, l);
- l->append(L", ");
- LogParam(p.width, l);
- l->append(L", ");
- LogParam(p.height, l);
- l->append(L")");
- }
+ 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);
};
template <>
struct ParamTraits<WebKit::WebScreenInfo> {
typedef WebKit::WebScreenInfo param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.depth);
- WriteParam(m, p.depthPerComponent);
- WriteParam(m, p.isMonochrome);
- WriteParam(m, p.rect);
- WriteParam(m, p.availableRect);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->depth) &&
- ReadParam(m, iter, &p->depthPerComponent) &&
- ReadParam(m, iter, &p->isMonochrome) &&
- ReadParam(m, iter, &p->rect) &&
- ReadParam(m, iter, &p->availableRect);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.depth, l);
- l->append(L", ");
- LogParam(p.depthPerComponent, l);
- l->append(L", ");
- LogParam(p.isMonochrome, l);
- l->append(L", ");
- LogParam(p.rect, l);
- l->append(L", ");
- LogParam(p.availableRect, l);
- l->append(L")");
- }
+ 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);
};
template <>
@@ -141,26 +99,9 @@ struct ParamTraits<WebKit::WebPopupType> {
template <>
struct ParamTraits<WebKit::WebFindOptions> {
typedef WebKit::WebFindOptions param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.forward);
- WriteParam(m, p.matchCase);
- WriteParam(m, p.findNext);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->forward) &&
- ReadParam(m, iter, &p->matchCase) &&
- ReadParam(m, iter, &p->findNext);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.forward, l);
- l->append(L", ");
- LogParam(p.matchCase, l);
- l->append(L", ");
- LogParam(p.findNext, l);
- l->append(L")");
- }
+ 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);
};
template <>
@@ -378,30 +319,9 @@ template <>
template <>
struct ParamTraits<WebKit::WebCompositionUnderline> {
typedef WebKit::WebCompositionUnderline param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.startOffset);
- WriteParam(m, p.endOffset);
- WriteParam(m, p.color);
- WriteParam(m, p.thick);
- }
- static bool Read(const Message* m, void** iter, param_type* p) {
- return
- ReadParam(m, iter, &p->startOffset) &&
- ReadParam(m, iter, &p->endOffset) &&
- ReadParam(m, iter, &p->color) &&
- ReadParam(m, iter, &p->thick);
- }
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
- LogParam(p.startOffset, l);
- l->append(L",");
- LogParam(p.endOffset, l);
- l->append(L":");
- LogParam(p.color, l);
- l->append(L":");
- LogParam(p.thick, l);
- l->append(L")");
- }
+ 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);
};
template <>
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index fbc73ed..d5b9b71 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -95,6 +95,7 @@
#include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFormControlElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
@@ -144,6 +145,7 @@
#include "webkit/glue/plugins/webplugin_impl.h"
#include "webkit/glue/plugins/webview_plugin.h"
#include "webkit/glue/site_isolation_metrics.h"
+#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/webdropdata.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webmediaplayer_impl.h"