OLD | NEW |
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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/chromeos/device_hierarchy_observer.h" | 11 #include "chrome/browser/chromeos/device_hierarchy_observer.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 namespace system { | 14 namespace system { |
15 | 15 |
16 class PointerDeviceObserver | 16 class PointerDeviceObserver : public DeviceHierarchyObserver { |
17 : public DeviceHierarchyObserver { | |
18 public: | 17 public: |
19 PointerDeviceObserver(); | 18 PointerDeviceObserver(); |
20 virtual ~PointerDeviceObserver(); | 19 virtual ~PointerDeviceObserver(); |
21 | 20 |
22 void Init(); | 21 void Init(); |
23 | 22 |
24 class Observer { | 23 class Observer { |
25 public: | 24 public: |
26 virtual void TouchpadExists(bool exists) = 0; | 25 virtual void TouchpadExists(bool exists) = 0; |
27 virtual void MouseExists(bool exists) = 0; | 26 virtual void MouseExists(bool exists) = 0; |
28 | 27 |
29 protected: | 28 protected: |
30 Observer() {} | 29 Observer() {} |
31 virtual ~Observer(); | 30 virtual ~Observer(); |
32 | 31 |
33 private: | 32 private: |
34 DISALLOW_COPY_AND_ASSIGN(Observer); | 33 DISALLOW_COPY_AND_ASSIGN(Observer); |
35 }; | 34 }; |
36 void AddObserver(Observer* observer); | 35 void AddObserver(Observer* observer); |
37 void RemoveObserver(Observer* observer); | 36 void RemoveObserver(Observer* observer); |
38 | 37 |
39 private: | 38 private: |
40 // DeviceHierarchyObserver implementation. | 39 // DeviceHierarchyObserver implementation. |
41 virtual void DeviceHierarchyChanged() OVERRIDE; | 40 virtual void DeviceHierarchyChanged() OVERRIDE; |
| 41 virtual void DeviceAdded(int device_id) OVERRIDE {} |
| 42 virtual void DeviceRemoved(int device_id) OVERRIDE {} |
| 43 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE {} |
42 | 44 |
43 // Check for input devices. | 45 // Check for input devices. |
44 void CheckTouchpadExists(); | 46 void CheckTouchpadExists(); |
45 void CheckMouseExists(); | 47 void CheckMouseExists(); |
46 | 48 |
47 // Callback for input device checks. | 49 // Callback for input device checks. |
48 void TouchpadExists(bool* exists); | 50 void TouchpadExists(bool* exists); |
49 void MouseExists(bool* exists); | 51 void MouseExists(bool* exists); |
50 | 52 |
51 ObserverList<Observer> observers_; | 53 ObserverList<Observer> observers_; |
52 | 54 |
53 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_; | 55 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_; |
54 | 56 |
55 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver); | 57 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver); |
56 }; | 58 }; |
57 | 59 |
58 } // namespace system | 60 } // namespace system |
59 } // namespace chromeos | 61 } // namespace chromeos |
60 | 62 |
61 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ | 63 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ |
OLD | NEW |