Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: content/common/input/input_event.h

Issue 19624005: Add InputEvent and EventPacket types for batched input delivery (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Win export fix Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/input/event_packet.cc ('k') | content/common/input/input_event.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_INPUT_EVENT_H_
6 #define CONTENT_COMMON_INPUT_INPUT_EVENT_H_
7
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h"
11
12 namespace content {
13
14 // An id'ed event that carries a specific input payload.
15 class CONTENT_EXPORT InputEvent {
16 public:
17 // Input data carried by the InputEvent.
18 class CONTENT_EXPORT Payload {
19 public:
20 enum Type {
21 IPC_MESSAGE,
22 WEB_INPUT_EVENT,
23 PAYLOAD_TYPE_MAX = WEB_INPUT_EVENT
24 };
25 virtual ~Payload() {}
26 virtual Type GetType() const = 0;
27 };
28
29 // A valid InputEvent has a non-zero |id| and a non-NULL |payload|.
30 static scoped_ptr<InputEvent> Create(int64 id, scoped_ptr<Payload> payload);
31
32 template <typename PayloadType>
33 static scoped_ptr<InputEvent> Create(int64 id,
34 scoped_ptr<PayloadType> payload) {
35 return Create(id, payload.template PassAs<Payload>());
36 }
37
38 InputEvent();
39 virtual ~InputEvent();
40
41 // Returns true if the initialized InputEvent is |valid()|, false otherwise.
42 bool Initialize(int64 id, scoped_ptr<Payload> payload);
43
44 int64 id() const { return id_; }
45 const Payload* payload() const { return payload_.get(); }
46 bool valid() const { return id() && payload(); }
47
48 protected:
49 InputEvent(int64 id, scoped_ptr<Payload> payload);
50
51 private:
52 int64 id_;
53 scoped_ptr<Payload> payload_;
54
55 DISALLOW_COPY_AND_ASSIGN(InputEvent);
56 };
57
58 } // namespace content
59
60 #endif // CONTENT_COMMON_INPUT_INPUT_EVENT_H_
OLDNEW
« no previous file with comments | « content/common/input/event_packet.cc ('k') | content/common/input/input_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698