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

Side by Side Diff: ui/events/devices/input_device_manager.h

Issue 2978873002: Singletons changes necessary to run the UI Service inside the browser's process. (Closed)
Patch Set: Removing unneeded dependency. Created 3 years, 5 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 | « services/ui/gpu/gpu_main.cc ('k') | ui/events/devices/input_device_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_DEVICES_INPUT_DEVICE_MANAGER_H_ 5 #ifndef UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_
6 #define UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ 6 #define UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/events/devices/events_devices_export.h" 11 #include "ui/events/devices/events_devices_export.h"
12 #include "ui/events/devices/input_device.h" 12 #include "ui/events/devices/input_device.h"
13 #include "ui/events/devices/input_device_event_observer.h" 13 #include "ui/events/devices/input_device_event_observer.h"
14 #include "ui/events/devices/touchscreen_device.h" 14 #include "ui/events/devices/touchscreen_device.h"
15 15
16 namespace ui { 16 namespace ui {
17 17
18 // Interface to query available input devices. Holds a static pointer to an 18 // Interface to query available input devices. Holds a thread-local pointer to
19 // implementation that provides this service. The implementation could be 19 // an implementation that provides this service. The implementation could be
20 // DeviceDataManager or something that mirrors the necessary state if 20 // DeviceDataManager or something that mirrors the necessary state if
21 // DeviceDataManager is in a different process. 21 // DeviceDataManager is in a different process.
22 class EVENTS_DEVICES_EXPORT InputDeviceManager { 22 class EVENTS_DEVICES_EXPORT InputDeviceManager {
23 public: 23 public:
24 InputDeviceManager() {} 24 InputDeviceManager() {}
25 25
26 static InputDeviceManager* GetInstance(); 26 static InputDeviceManager* GetInstance();
27 static bool HasInstance(); 27 static bool HasInstance();
28 28
29 virtual const std::vector<InputDevice>& GetKeyboardDevices() const = 0; 29 virtual const std::vector<InputDevice>& GetKeyboardDevices() const = 0;
30 virtual const std::vector<TouchscreenDevice>& GetTouchscreenDevices() 30 virtual const std::vector<TouchscreenDevice>& GetTouchscreenDevices()
31 const = 0; 31 const = 0;
32 virtual const std::vector<InputDevice>& GetMouseDevices() const = 0; 32 virtual const std::vector<InputDevice>& GetMouseDevices() const = 0;
33 virtual const std::vector<InputDevice>& GetTouchpadDevices() const = 0; 33 virtual const std::vector<InputDevice>& GetTouchpadDevices() const = 0;
34 34
35 virtual bool AreDeviceListsComplete() const = 0; 35 virtual bool AreDeviceListsComplete() const = 0;
36 virtual bool AreTouchscreensEnabled() const = 0; 36 virtual bool AreTouchscreensEnabled() const = 0;
37 37
38 virtual void AddObserver(InputDeviceEventObserver* observer) = 0; 38 virtual void AddObserver(InputDeviceEventObserver* observer) = 0;
39 virtual void RemoveObserver(InputDeviceEventObserver* observer) = 0; 39 virtual void RemoveObserver(InputDeviceEventObserver* observer) = 0;
40 40
41 protected: 41 protected:
42 // Sets the instance. This should only be set once per process. 42 // Sets the instance. This should only be set once per thread.
43 static void SetInstance(InputDeviceManager* instance); 43 static void SetInstance(InputDeviceManager* instance);
44 44
45 // Clears the instance. InputDeviceManager doesn't own the instance and won't 45 // Clears the instance. InputDeviceManager doesn't own the instance and won't
46 // destroy it, so it should be cleared before it is destroyed elsewhere. 46 // destroy it, so it should be cleared before it is destroyed elsewhere.
47 static void ClearInstance(); 47 static void ClearInstance();
48 48
49 private: 49 private:
50 static InputDeviceManager* instance_; // Not owned. 50 static InputDeviceManager* instance_; // Not owned.
51 51
52 DISALLOW_COPY_AND_ASSIGN(InputDeviceManager); 52 DISALLOW_COPY_AND_ASSIGN(InputDeviceManager);
53 }; 53 };
54 54
55 } // namespace ui 55 } // namespace ui
56 56
57 #endif // UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ 57 #endif // UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_main.cc ('k') | ui/events/devices/input_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698