OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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. |
| 4 |
| 5 #ifndef CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_PAYLOAD_H_ |
| 6 #define CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_PAYLOAD_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "content/common/input/input_event.h" |
| 11 #include "ui/base/latency_info.h" |
| 12 |
| 13 namespace WebKit { |
| 14 class WebInputEvent; |
| 15 } |
| 16 |
| 17 namespace content { |
| 18 |
| 19 // Wraps a WebKit::WebInputEvent. |
| 20 class CONTENT_EXPORT WebInputEventPayload : public InputEvent::Payload { |
| 21 public: |
| 22 static scoped_ptr<WebInputEventPayload> Create(); |
| 23 static scoped_ptr<WebInputEventPayload> Create( |
| 24 const WebKit::WebInputEvent& event, |
| 25 const ui::LatencyInfo& latency_info, |
| 26 bool is_keyboard_shortcut); |
| 27 |
| 28 static const WebInputEventPayload* Cast(const Payload* payload); |
| 29 |
| 30 virtual ~WebInputEventPayload(); |
| 31 |
| 32 // InputEvent::Payload |
| 33 virtual Type GetType() const OVERRIDE; |
| 34 |
| 35 void Initialize(const WebKit::WebInputEvent& event, |
| 36 const ui::LatencyInfo& latency_info, |
| 37 bool is_keyboard_shortcut); |
| 38 |
| 39 // True for WebTouchEvents only. |
| 40 bool CanCreateFollowupEvents() const; |
| 41 |
| 42 const WebKit::WebInputEvent* web_event() const { return web_event_.get(); } |
| 43 const ui::LatencyInfo& latency_info() const { return latency_info_; } |
| 44 bool is_keyboard_shortcut() const { return is_keyboard_shortcut_; } |
| 45 |
| 46 // WebKit::WebInputEvent does not provide a virtual destructor. |
| 47 struct WebInputEventDeleter { |
| 48 WebInputEventDeleter(); |
| 49 void operator()(WebKit::WebInputEvent* event) const; |
| 50 }; |
| 51 typedef scoped_ptr<WebKit::WebInputEvent, |
| 52 WebInputEventDeleter> ScopedWebInputEvent; |
| 53 |
| 54 protected: |
| 55 WebInputEventPayload(); |
| 56 |
| 57 private: |
| 58 ScopedWebInputEvent web_event_; |
| 59 ui::LatencyInfo latency_info_; |
| 60 bool is_keyboard_shortcut_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(WebInputEventPayload); |
| 63 }; |
| 64 |
| 65 } // namespace content |
| 66 |
| 67 #endif // CONTENT_COMMON_INPUT_WEB_INPUT_EVENT_PAYLOAD_H_ |
OLD | NEW |