| Index: content/common/common_param_traits.h
|
| ===================================================================
|
| --- content/common/common_param_traits.h (revision 77652)
|
| +++ content/common/common_param_traits.h (working copy)
|
| @@ -27,11 +27,18 @@
|
|
|
| // TODO(erg): The following headers are historical and only work because
|
| // their definitions are inlined, which also needs to be fixed.
|
| +#include "ui/gfx/native_widget_types.h"
|
| #include "webkit/glue/resource_type.h"
|
|
|
| // Forward declarations.
|
| class GURL;
|
|
|
| +namespace gfx {
|
| +class Point;
|
| +class Rect;
|
| +class Size;
|
| +} // namespace gfx
|
| +
|
| namespace net {
|
| class HttpResponseHeaders;
|
| class HostPortPair;
|
| @@ -122,6 +129,62 @@
|
| typedef int Type;
|
| };
|
|
|
| +template <>
|
| +struct ParamTraits<gfx::Point> {
|
| + typedef gfx::Point param_type;
|
| + static void Write(Message* m, const param_type& p);
|
| + static bool Read(const Message* m, void** iter, param_type* r);
|
| + static void Log(const param_type& p, std::string* l);
|
| +};
|
| +
|
| +template <>
|
| +struct ParamTraits<gfx::Size> {
|
| + typedef gfx::Size param_type;
|
| + static void Write(Message* m, const param_type& p);
|
| + static bool Read(const Message* m, void** iter, param_type* r);
|
| + static void Log(const param_type& p, std::string* l);
|
| +};
|
| +
|
| +template <>
|
| +struct ParamTraits<gfx::Rect> {
|
| + typedef gfx::Rect param_type;
|
| + static void Write(Message* m, const param_type& p);
|
| + static bool Read(const Message* m, void** iter, param_type* r);
|
| + static void Log(const param_type& p, std::string* l);
|
| +};
|
| +
|
| +template <>
|
| +struct ParamTraits<gfx::NativeWindow> {
|
| + typedef gfx::NativeWindow param_type;
|
| + static void Write(Message* m, const param_type& p) {
|
| +#if defined(OS_WIN)
|
| + // HWNDs are always 32 bits on Windows, even on 64 bit systems.
|
| + m->WriteUInt32(reinterpret_cast<uint32>(p));
|
| +#else
|
| + m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p));
|
| +#endif
|
| + }
|
| + static bool Read(const Message* m, void** iter, param_type* r) {
|
| +#if defined(OS_WIN)
|
| + return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
|
| +#else
|
| + const char *data;
|
| + int data_size = 0;
|
| + bool result = m->ReadData(iter, &data, &data_size);
|
| + if (result && data_size == sizeof(gfx::NativeWindow)) {
|
| + memcpy(r, data, sizeof(gfx::NativeWindow));
|
| + } else {
|
| + result = false;
|
| + NOTREACHED();
|
| + }
|
| + return result;
|
| +#endif
|
| + }
|
| + static void Log(const param_type& p, std::string* l) {
|
| + l->append("<gfx::NativeWindow>");
|
| + }
|
| +};
|
| +
|
| } // namespace IPC
|
|
|
| #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_
|
|
|