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

Side by Side Diff: ui/events/ozone/evdev/touch_event_converter.h

Issue 133233008: evdev: Move EventConverterOzone ownership from EventFactoryOzone to subclass (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unbreak events_unittests Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ 6 #define UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/message_loop/message_pump_libevent.h"
12 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
13 #include "ui/events/events_export.h" 14 #include "ui/events/events_export.h"
14 #include "ui/events/ozone/event_converter_ozone.h" 15 #include "ui/events/ozone/event_converter_ozone.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
18 class TouchEvent; 19 class TouchEvent;
19 20
20 class EVENTS_EXPORT TouchEventConverterEvdev : public EventConverterOzone { 21 class EVENTS_EXPORT TouchEventConverterEvdev
22 : public EventConverterOzone,
23 base::MessagePumpLibevent::Watcher {
21 public: 24 public:
22 enum { 25 enum {
23 MAX_FINGERS = 11 26 MAX_FINGERS = 11
24 }; 27 };
25 TouchEventConverterEvdev(int fd, base::FilePath path); 28 TouchEventConverterEvdev(int fd, base::FilePath path);
26 virtual ~TouchEventConverterEvdev(); 29 virtual ~TouchEventConverterEvdev();
27 30
28 private: 31 private:
29 friend class MockTouchEventConverterEvdev; 32 friend class MockTouchEventConverterEvdev;
30 33
31 // Unsafe part of initialization. 34 // Unsafe part of initialization.
32 void Init(); 35 void Init();
33 36
37 // Start & stop watching for events.
38 void Start();
39 void Stop();
40
34 // Overidden from base::MessagePumpLibevent::Watcher. 41 // Overidden from base::MessagePumpLibevent::Watcher.
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 42 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; 43 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
37 44
38 // Pressure values. 45 // Pressure values.
39 int pressure_min_; 46 int pressure_min_;
40 int pressure_max_; // Used to normalize pressure values. 47 int pressure_max_; // Used to normalize pressure values.
41 48
42 // Touch scaling. 49 // Touch scaling.
43 float x_scale_; 50 float x_scale_;
(...skipping 23 matching lines...) Expand all
67 int finger_; // "Finger" id starting from 0; -1 means not active 74 int finger_; // "Finger" id starting from 0; -1 means not active
68 75
69 EventType type_; 76 EventType type_;
70 int major_; 77 int major_;
71 float pressure_; 78 float pressure_;
72 }; 79 };
73 80
74 // In-progress touch points. 81 // In-progress touch points.
75 InProgressEvents events_[MAX_FINGERS]; 82 InProgressEvents events_[MAX_FINGERS];
76 83
84 // Controller for watching the input fd.
85 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
86
77 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev); 87 DISALLOW_COPY_AND_ASSIGN(TouchEventConverterEvdev);
78 }; 88 };
79 89
80 } // namespace ui 90 } // namespace ui
81 91
82 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_ 92 #endif // UI_EVENTS_OZONE_EVDEV_TOUCH_EVENT_CONVERTER_EVDEV_H_
83 93
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/key_event_converter_unittest.cc ('k') | ui/events/ozone/evdev/touch_event_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698