1 // Copyright 2013 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 #ifndef CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_
6 #define CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_
8 #include "ui/events/latency_info.h"
10 #include "content/common/input/web_input_event_traits.h"
13 class WebGestureEvent;
15 class WebMouseWheelEvent;
22 class EventWithLatencyInfo {
25 ui::LatencyInfo latency;
27 EventWithLatencyInfo(const T& e, const ui::LatencyInfo& l)
28 : event(e), latency(l) {}
30 EventWithLatencyInfo() {}
32 bool CanCoalesceWith(const EventWithLatencyInfo& other)
33 const WARN_UNUSED_RESULT {
34 return WebInputEventTraits::CanCoalesce(other.event, event);
37 void CoalesceWith(const EventWithLatencyInfo& other) {
38 WebInputEventTraits::Coalesce(other.event, &event);
39 latency.MergeWith(other.latency);
43 typedef EventWithLatencyInfo<WebKit::WebGestureEvent>
44 GestureEventWithLatencyInfo;
45 typedef EventWithLatencyInfo<WebKit::WebMouseWheelEvent>
46 MouseWheelEventWithLatencyInfo;
47 typedef EventWithLatencyInfo<WebKit::WebMouseEvent>
48 MouseEventWithLatencyInfo;
49 typedef EventWithLatencyInfo<WebKit::WebTouchEvent>
50 TouchEventWithLatencyInfo;
52 } // namespace content
54 #endif // CONTENT_PORT_BROWSER_EVENT_WITH_LATENCY_INFO_H_