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

Side by Side Diff: chrome/browser/chromeos/system/pointer_device_observer.h

Issue 946173002: Make PointerDeviceObserver use ui::InputDeviceEventObserver on X11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "chrome/browser/chromeos/device_hierarchy_observer.h"
11 #include "ui/events/devices/input_device_event_observer.h" 10 #include "ui/events/devices/input_device_event_observer.h"
12 11
13 namespace chromeos { 12 namespace chromeos {
14 namespace system { 13 namespace system {
15 14
16 class PointerDeviceObserver : public DeviceHierarchyObserver, 15 class PointerDeviceObserver : public ui::InputDeviceEventObserver {
17 public ui::InputDeviceEventObserver {
18 public: 16 public:
19 PointerDeviceObserver(); 17 PointerDeviceObserver();
20 ~PointerDeviceObserver() override; 18 ~PointerDeviceObserver() override;
21 19
22 // Start observing device hierarchy. 20 // Start observing device hierarchy.
23 void Init(); 21 void Init();
24 22
25 // Check for presence of devices. 23 // Check for presence of devices.
26 void CheckDevices(); 24 void CheckDevices();
27 25
28 class Observer { 26 class Observer {
29 public: 27 public:
30 virtual void TouchpadExists(bool exists) = 0; 28 virtual void TouchpadExists(bool exists) = 0;
31 virtual void MouseExists(bool exists) = 0; 29 virtual void MouseExists(bool exists) = 0;
32 30
33 protected: 31 protected:
34 Observer() {} 32 Observer() {}
35 virtual ~Observer(); 33 virtual ~Observer();
36 }; 34 };
37 void AddObserver(Observer* observer); 35 void AddObserver(Observer* observer);
38 void RemoveObserver(Observer* observer); 36 void RemoveObserver(Observer* observer);
39 37
40 private: 38 private:
41 // DeviceHierarchyObserver:
42 void DeviceHierarchyChanged() override;
43 void DeviceAdded(int device_id) override {}
44 void DeviceRemoved(int device_id) override {}
45
46 // InputDeviceEventObserver: 39 // InputDeviceEventObserver:
47 void OnMouseDeviceConfigurationChanged() override; 40 void OnMouseDeviceConfigurationChanged() override;
48 void OnTouchpadDeviceConfigurationChanged() override; 41 void OnTouchpadDeviceConfigurationChanged() override;
49 42
50 // Check for pointer devices. 43 // Check for pointer devices.
51 void CheckTouchpadExists(); 44 void CheckTouchpadExists();
52 void CheckMouseExists(); 45 void CheckMouseExists();
53 46
54 // Callback for pointer device checks. 47 // Callback for pointer device checks.
55 void OnTouchpadExists(bool exists); 48 void OnTouchpadExists(bool exists);
56 void OnMouseExists(bool exists); 49 void OnMouseExists(bool exists);
57 50
58 ObserverList<Observer> observers_; 51 ObserverList<Observer> observers_;
59 52
60 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_; 53 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_;
61 54
62 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver); 55 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver);
63 }; 56 };
64 57
65 } // namespace system 58 } // namespace system
66 } // namespace chromeos 59 } // namespace chromeos
67 60
68 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 61 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698