OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is used to define IPC::ParamTraits<> specializations for a number | 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<> | 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 | 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 | 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 | 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 | 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 | 11 // public members, or because the same type is being used in multiple |
12 // *_messages.h headers. | 12 // *_messages.h headers. |
13 | 13 |
14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 14 #ifndef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 15 #define CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
16 | 16 |
17 #include <stdint.h> | 17 #include <stdint.h> |
18 | 18 |
19 #include <string> | 19 #include <string> |
20 | 20 |
21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "content/public/common/common_param_traits_macros.h" | 24 #include "content/public/common/common_param_traits_macros.h" |
| 25 #include "content/public/common/input/scoped_web_input_event.h" |
25 #include "ipc/ipc_message_utils.h" | 26 #include "ipc/ipc_message_utils.h" |
| 27 #include "third_party/WebKit/public/web/WebInputEvent.h" |
26 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
27 #include "ui/surface/transport_dib.h" | 29 #include "ui/surface/transport_dib.h" |
28 #include "url/gurl.h" | 30 #include "url/gurl.h" |
29 #include "url/origin.h" | 31 #include "url/origin.h" |
30 | 32 |
31 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
32 #include "base/win/win_util.h" | 34 #include "base/win/win_util.h" |
33 #endif | 35 #endif |
34 | 36 |
35 namespace content { | 37 namespace content { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 NOTREACHED(); | 119 NOTREACHED(); |
118 } | 120 } |
119 return result; | 121 return result; |
120 #endif | 122 #endif |
121 } | 123 } |
122 static void Log(const param_type& p, std::string* l) { | 124 static void Log(const param_type& p, std::string* l) { |
123 l->append("<gfx::NativeWindow>"); | 125 l->append("<gfx::NativeWindow>"); |
124 } | 126 } |
125 }; | 127 }; |
126 | 128 |
| 129 typedef const blink::WebInputEvent* WebInputEventPointer; |
| 130 template <> |
| 131 struct CONTENT_EXPORT ParamTraits<WebInputEventPointer> { |
| 132 typedef WebInputEventPointer param_type; |
| 133 static void Write(Message* m, const param_type& p); |
| 134 // Note: upon read, the event has the lifetime of the message. |
| 135 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 136 static void Log(const param_type& p, std::string* l); |
| 137 }; |
| 138 |
| 139 template <> |
| 140 struct CONTENT_EXPORT ParamTraits<content::ScopedWebInputEvent> { |
| 141 typedef content::ScopedWebInputEvent param_type; |
| 142 static void Write(Message* m, const param_type& p); |
| 143 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); |
| 144 static void Log(const param_type& p, std::string* l); |
| 145 }; |
| 146 |
127 } // namespace IPC | 147 } // namespace IPC |
128 | 148 |
129 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ | 149 #endif // CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_H_ |
OLD | NEW |