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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_INPUT_DEVICE_FACTORY_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ 6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <set> 10 #include <set>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/task_runner.h" 18 #include "base/task_runner.h"
19 #include "ui/events/ozone/evdev/event_converter_evdev.h" 19 #include "ui/events/ozone/evdev/event_converter_evdev.h"
20 #include "ui/events/ozone/evdev/event_device_info.h" 20 #include "ui/events/ozone/evdev/event_device_info.h"
21 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 21 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
22 #include "ui/events/ozone/evdev/input_device_settings_evdev.h" 22 #include "ui/events/ozone/evdev/input_device_settings_evdev.h"
23 23
24 namespace ui { 24 namespace ui {
25 25
26 class CursorDelegateEvdev; 26 class CursorDelegateEvdev;
27 class DeviceEventDispatcherEvdev; 27 class DeviceEventDispatcherEvdev;
28 class InputDeviceFactoryEvdevProxy; 28 class InputDeviceFactoryEvdevProxy;
29 29
30 #if !defined(USE_EVDEV) 30 #if !defined(USE_EVDEV)
31 #error Missing dependency on ui/events/ozone:events_ozone_evdev 31 #error Missing dependency on ui/events/ozone:events_ozone_evdev
32 #endif 32 #endif
33 33
34 #if defined(USE_EVDEV_GESTURES) 34 #if defined(USE_EVDEV_GESTURES)
35 class GesturePropertyProvider; 35 class GesturePropertyProvider;
36 #endif 36 #endif
37 37
38 typedef base::Callback<void(scoped_ptr<std::string>)> GetTouchDeviceStatusReply; 38 typedef base::Callback<void(std::unique_ptr<std::string>)>
39 typedef base::Callback<void(scoped_ptr<std::vector<base::FilePath>>)> 39 GetTouchDeviceStatusReply;
40 typedef base::Callback<void(std::unique_ptr<std::vector<base::FilePath>>)>
40 GetTouchEventLogReply; 41 GetTouchEventLogReply;
41 42
42 // Manager for event device objects. All device I/O starts here. 43 // Manager for event device objects. All device I/O starts here.
43 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev { 44 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
44 public: 45 public:
45 InputDeviceFactoryEvdev(scoped_ptr<DeviceEventDispatcherEvdev> dispatcher, 46 InputDeviceFactoryEvdev(
46 CursorDelegateEvdev* cursor); 47 std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher,
48 CursorDelegateEvdev* cursor);
47 ~InputDeviceFactoryEvdev(); 49 ~InputDeviceFactoryEvdev();
48 50
49 // Open & start reading a newly plugged-in input device. 51 // Open & start reading a newly plugged-in input device.
50 void AddInputDevice(int id, const base::FilePath& path); 52 void AddInputDevice(int id, const base::FilePath& path);
51 53
52 // Stop reading & close an unplugged input device. 54 // Stop reading & close an unplugged input device.
53 void RemoveInputDevice(const base::FilePath& path); 55 void RemoveInputDevice(const base::FilePath& path);
54 56
55 // Device thread handler for initial scan completion. 57 // Device thread handler for initial scan completion.
56 void OnStartupScanComplete(); 58 void OnStartupScanComplete();
57 59
58 // LED state. 60 // LED state.
59 void SetCapsLockLed(bool enabled); 61 void SetCapsLockLed(bool enabled);
60 62
61 // Bits from InputController that have to be answered on IO. 63 // Bits from InputController that have to be answered on IO.
62 void UpdateInputDeviceSettings(const InputDeviceSettingsEvdev& settings); 64 void UpdateInputDeviceSettings(const InputDeviceSettingsEvdev& settings);
63 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply& reply); 65 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply& reply);
64 void GetTouchEventLog(const base::FilePath& out_dir, 66 void GetTouchEventLog(const base::FilePath& out_dir,
65 const GetTouchEventLogReply& reply); 67 const GetTouchEventLogReply& reply);
66 68
67 base::WeakPtr<InputDeviceFactoryEvdev> GetWeakPtr(); 69 base::WeakPtr<InputDeviceFactoryEvdev> GetWeakPtr();
68 70
69 private: 71 private:
70 // Open device at path & starting processing events (on UI thread). 72 // Open device at path & starting processing events (on UI thread).
71 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); 73 void AttachInputDevice(std::unique_ptr<EventConverterEvdev> converter);
72 74
73 // Close device at path (on UI thread). 75 // Close device at path (on UI thread).
74 void DetachInputDevice(const base::FilePath& file_path); 76 void DetachInputDevice(const base::FilePath& file_path);
75 77
76 // Sync input_device_settings_ to attached devices. 78 // Sync input_device_settings_ to attached devices.
77 void ApplyInputDeviceSettings(); 79 void ApplyInputDeviceSettings();
78 void ApplyCapsLockLed(); 80 void ApplyCapsLockLed();
79 81
80 // Policy for device enablement. 82 // Policy for device enablement.
81 bool IsDeviceEnabled(const EventConverterEvdev* converter); 83 bool IsDeviceEnabled(const EventConverterEvdev* converter);
(...skipping 17 matching lines...) Expand all
99 std::map<base::FilePath, EventConverterEvdev*> converters_; 101 std::map<base::FilePath, EventConverterEvdev*> converters_;
100 102
101 // Task runner for our thread. 103 // Task runner for our thread.
102 scoped_refptr<base::TaskRunner> task_runner_; 104 scoped_refptr<base::TaskRunner> task_runner_;
103 105
104 // Cursor movement. 106 // Cursor movement.
105 CursorDelegateEvdev* cursor_; 107 CursorDelegateEvdev* cursor_;
106 108
107 #if defined(USE_EVDEV_GESTURES) 109 #if defined(USE_EVDEV_GESTURES)
108 // Gesture library property provider (used by touchpads/mice). 110 // Gesture library property provider (used by touchpads/mice).
109 scoped_ptr<GesturePropertyProvider> gesture_property_provider_; 111 std::unique_ptr<GesturePropertyProvider> gesture_property_provider_;
110 #endif 112 #endif
111 113
112 // Dispatcher for events. 114 // Dispatcher for events.
113 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher_; 115 std::unique_ptr<DeviceEventDispatcherEvdev> dispatcher_;
114 116
115 // Number of pending device additions & device classes. 117 // Number of pending device additions & device classes.
116 int pending_device_changes_ = 0; 118 int pending_device_changes_ = 0;
117 bool touchscreen_list_dirty_ = true; 119 bool touchscreen_list_dirty_ = true;
118 bool keyboard_list_dirty_ = true; 120 bool keyboard_list_dirty_ = true;
119 bool mouse_list_dirty_ = true; 121 bool mouse_list_dirty_ = true;
120 bool touchpad_list_dirty_ = true; 122 bool touchpad_list_dirty_ = true;
121 123
122 // Whether we have a list of devices that were present at startup. 124 // Whether we have a list of devices that were present at startup.
123 bool startup_devices_enumerated_ = false; 125 bool startup_devices_enumerated_ = false;
124 126
125 // Whether devices that were present at startup are open. 127 // Whether devices that were present at startup are open.
126 bool startup_devices_opened_ = false; 128 bool startup_devices_opened_ = false;
127 129
128 // LEDs. 130 // LEDs.
129 bool caps_lock_led_enabled_ = false; 131 bool caps_lock_led_enabled_ = false;
130 132
131 // Device settings. These primarily affect libgestures behavior. 133 // Device settings. These primarily affect libgestures behavior.
132 InputDeviceSettingsEvdev input_device_settings_; 134 InputDeviceSettingsEvdev input_device_settings_;
133 135
134 // Support weak pointers for attach & detach callbacks. 136 // Support weak pointers for attach & detach callbacks.
135 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_; 137 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_;
136 138
137 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev); 139 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev);
138 }; 140 };
139 141
140 } // namespace ui 142 } // namespace ui
141 143
142 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ 144 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/input_controller_evdev.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698