OLD | NEW |
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 CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 virtual void OnInputDeviceAdded(const InputDeviceInfo& info) = 0; | 28 virtual void OnInputDeviceAdded(const InputDeviceInfo& info) = 0; |
29 virtual void OnInputDeviceRemoved(const std::string& id) = 0; | 29 virtual void OnInputDeviceRemoved(const std::string& id) = 0; |
30 }; | 30 }; |
31 | 31 |
32 typedef base::Callback<void(const std::vector<InputDeviceInfo>& devices)> | 32 typedef base::Callback<void(const std::vector<InputDeviceInfo>& devices)> |
33 GetDevicesCallback; | 33 GetDevicesCallback; |
34 typedef base::Callback<void(bool success, const InputDeviceInfo& info)> | 34 typedef base::Callback<void(bool success, const InputDeviceInfo& info)> |
35 GetDeviceInfoCallback; | 35 GetDeviceInfoCallback; |
36 | 36 |
37 InputServiceProxy(); | 37 InputServiceProxy(); |
38 ~InputServiceProxy(); | 38 virtual ~InputServiceProxy(); |
39 | 39 |
40 // Used for early init for cashing info about available HID. | 40 // Used for early init for cashing info about available HID. |
41 static void WarmUp(); | 41 static void WarmUp(); |
42 | 42 |
43 void AddObserver(Observer* observer); | 43 void AddObserver(Observer* observer); |
44 void RemoveObserver(Observer* observer); | 44 void RemoveObserver(Observer* observer); |
45 | 45 |
46 void GetDevices(const GetDevicesCallback& callback); | 46 virtual void GetDevices(const GetDevicesCallback& callback); |
47 void GetDeviceInfo(const std::string& id, | 47 virtual void GetDeviceInfo(const std::string& id, |
48 const GetDeviceInfoCallback& callback); | 48 const GetDeviceInfoCallback& callback); |
| 49 |
| 50 protected: |
| 51 ObserverList<Observer> observers_; |
49 | 52 |
50 private: | 53 private: |
51 class ServiceObserver; | 54 class ServiceObserver; |
52 | 55 |
53 void OnDeviceAdded(const device::InputServiceLinux::InputDeviceInfo& info); | 56 virtual void OnDeviceAdded( |
54 void OnDeviceRemoved(const std::string& id); | 57 const device::InputServiceLinux::InputDeviceInfo& info); |
| 58 virtual void OnDeviceRemoved(const std::string& id); |
55 | 59 |
56 ObserverList<Observer> observers_; | |
57 scoped_ptr<ServiceObserver> service_observer_; | 60 scoped_ptr<ServiceObserver> service_observer_; |
58 | 61 |
59 base::ThreadChecker thread_checker_; | 62 base::ThreadChecker thread_checker_; |
60 | 63 |
61 base::WeakPtrFactory<InputServiceProxy> weak_factory_; | 64 base::WeakPtrFactory<InputServiceProxy> weak_factory_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(InputServiceProxy); | 66 DISALLOW_COPY_AND_ASSIGN(InputServiceProxy); |
64 }; | 67 }; |
65 | 68 |
66 } // namespace chromeos | 69 } // namespace chromeos |
67 | 70 |
68 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ | 71 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ |
OLD | NEW |