OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_COMMON_INPUT_EVENT_PACKET_H_ | |
6 #define CONTENT_COMMON_INPUT_EVENT_PACKET_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/scoped_vector.h" | |
11 #include "content/common/content_export.h" | |
12 | |
13 namespace content { | |
14 | |
15 class InputEvent; | |
16 | |
17 // An id'ed sequence of InputEvents. | |
18 class CONTENT_EXPORT EventPacket { | |
19 public: | |
20 typedef ScopedVector<InputEvent> InputEvents; | |
21 | |
22 EventPacket(); | |
23 ~EventPacket(); | |
24 | |
25 // Only a non-NULL and valid |event| will be accepted and added to the packet. | |
26 // Returns true if |event| was added, and false otherwise. | |
27 bool Add(scoped_ptr<InputEvent> event); | |
28 | |
29 void set_id(int64 id) { id_ = id; } | |
30 int64 id() const { return id_; } | |
31 | |
32 // Accessor functions for convenience. | |
33 bool empty() const { return events_.empty(); } | |
34 size_t size() const { return events_.size(); } | |
35 InputEvents::const_iterator begin() const { return events_.end(); } | |
36 InputEvents::const_iterator end() const { return events_.end(); } | |
37 const InputEvents& events() const { return events_; } | |
38 | |
39 protected: | |
40 int64 id_; | |
41 InputEvents events_; | |
42 | |
43 private: | |
44 DISALLOW_COPY_AND_ASSIGN(EventPacket); | |
45 }; | |
46 | |
47 } // namespace content | |
48 | |
49 #endif // CONTENT_COMMON_INPUT_EVENT_PACKET_H_ | |
OLD | NEW |