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
3 // found in the LICENSE file.
5 #include "content/common/content_param_traits.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "content/common/input/web_input_event_traits.h"
9 #include "net/base/ip_endpoint.h"
13 void ParamTraits
<WebInputEventPointer
>::Write(Message
* m
, const param_type
& p
) {
14 m
->WriteData(reinterpret_cast<const char*>(p
), p
->size
);
17 bool ParamTraits
<WebInputEventPointer
>::Read(const Message
* m
,
22 if (!iter
->ReadData(&data
, &data_length
)) {
26 if (data_length
< static_cast<int>(sizeof(blink::WebInputEvent
))) {
30 param_type event
= reinterpret_cast<param_type
>(data
);
31 // Check that the data size matches that of the event.
32 if (data_length
!= static_cast<int>(event
->size
)) {
36 const size_t expected_size_for_type
=
37 content::WebInputEventTraits::GetSize(event
->type
);
38 if (data_length
!= static_cast<int>(expected_size_for_type
)) {
46 void ParamTraits
<WebInputEventPointer
>::Log(const param_type
& p
,
53 LogParam(p
->timeStampSeconds
, l
);
59 // Generate param traits write methods.
60 #include "ipc/param_traits_write_macros.h"
62 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
63 #include "content/common/content_param_traits_macros.h"
66 // Generate param traits read methods.
67 #include "ipc/param_traits_read_macros.h"
69 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
70 #include "content/common/content_param_traits_macros.h"
73 // Generate param traits log methods.
74 #include "ipc/param_traits_log_macros.h"
76 #undef CONTENT_COMMON_CONTENT_PARAM_TRAITS_MACROS_H_
77 #include "content/common/content_param_traits_macros.h"