blob: 61107aa06e187ec6dd73a8057e10451e3a32006f [file] [log] [blame]
[email protected]9d8ea302012-09-25 15:04:221// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This file is used to define IPC::ParamTraits<> specializations for a number
6// of types so that they can be serialized over IPC. IPC::ParamTraits<>
7// specializations for basic types (like int and std::string) and types in the
8// 'base' project can be found in ipc/ipc_message_utils.h. This file contains
9// specializations for types that are used by the content code, and which need
10// manual serialization code. This is usually because they're not structs with
11// public members, or because the same type is being used in multiple
12// *_messages.h headers.
13
14#ifndef CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_
15#define CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_
16
17#include "content/common/content_param_traits_macros.h"
[email protected]c2809346d2014-03-20 00:11:0318#include "content/common/cursors/webcursor.h"
[email protected]2255a9332013-06-17 05:12:3119#include "third_party/WebKit/public/web/WebInputEvent.h"
[email protected]9d8ea302012-09-25 15:04:2220
[email protected]db4fc1e2013-09-06 20:01:5121namespace net {
22class IPEndPoint;
[email protected]9d8ea302012-09-25 15:04:2223}
24
[email protected]9d8ea302012-09-25 15:04:2225namespace IPC {
26
27template <>
[email protected]c2809346d2014-03-20 00:11:0328struct ParamTraits<content::WebCursor> {
29 typedef content::WebCursor param_type;
rockot502c94f2016-02-03 20:20:1630 static void Write(base::Pickle* m, const param_type& p) { p.Serialize(m); }
31 static bool Read(const base::Pickle* m,
brettw05cfd8ddb2015-06-02 07:02:4732 base::PickleIterator* iter,
rockot502c94f2016-02-03 20:20:1633 param_type* r) {
[email protected]9d8ea302012-09-25 15:04:2234 return r->Deserialize(iter);
35 }
36 static void Log(const param_type& p, std::string* l) {
37 l->append("<WebCursor>");
38 }
39};
40
[email protected]180ef242013-11-07 06:50:4641typedef const blink::WebInputEvent* WebInputEventPointer;
[email protected]9d8ea302012-09-25 15:04:2242template <>
43struct ParamTraits<WebInputEventPointer> {
44 typedef WebInputEventPointer param_type;
rockot502c94f2016-02-03 20:20:1645 static void Write(base::Pickle* m, const param_type& p);
[email protected]9d8ea302012-09-25 15:04:2246 // Note: upon read, the event has the lifetime of the message.
rockot502c94f2016-02-03 20:20:1647 static bool Read(const base::Pickle* m,
48 base::PickleIterator* iter,
49 param_type* r);
[email protected]0dea1652012-12-14 00:09:0950 static void Log(const param_type& p, std::string* l);
[email protected]9d8ea302012-09-25 15:04:2251};
52
53} // namespace IPC
54
55#endif // CONTENT_COMMON_CONTENT_PARAM_TRAITS_H_