| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_CROS_SYNAPTICS_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_SYNAPTICS_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_SYNAPTICS_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_SYNAPTICS_LIBRARY_H_ |
| 7 | 7 |
| 8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
| 9 #include "third_party/cros/chromeos_synaptics.h" | 9 #include "third_party/cros/chromeos_synaptics.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 // This interface defines interaction with the ChromeOS synaptics library APIs. |
| 14 // Users can get an instance of this library class like this: |
| 15 // SynapticsLibrary::Get() |
| 16 // For a list of SynapticsPrameters, see third_party/cros/chromeos_synaptics.h |
| 17 class SynapticsLibrary { |
| 18 public: |
| 19 virtual ~SynapticsLibrary() {} |
| 20 // Sets a boolean parameter. The actual call will be run on the FILE thread. |
| 21 virtual void SetBoolParameter(SynapticsParameter param, bool value) = 0; |
| 22 |
| 23 // Sets a range parameter. The actual call will be run on the FILE thread. |
| 24 // Value should be between 1 and 10 inclusive. |
| 25 virtual void SetRangeParameter(SynapticsParameter param, int value) = 0; |
| 26 }; |
| 27 |
| 28 |
| 13 // This class handles the interaction with the ChromeOS synaptics library APIs. | 29 // This class handles the interaction with the ChromeOS synaptics library APIs. |
| 14 // Users can get an instance of this library class like this: | 30 // Users can get an instance of this library class like this: |
| 15 // SynapticsLibrary::Get() | 31 // SynapticsLibrary::Get() |
| 16 // For a list of SynapticsPrameters, see third_party/cros/chromeos_synaptics.h | 32 // For a list of SynapticsPrameters, see third_party/cros/chromeos_synaptics.h |
| 17 class SynapticsLibrary { | 33 class SynapticsLibraryImpl : public SynapticsLibrary { |
| 18 public: | 34 public: |
| 19 // This gets the singleton SynapticsLibrary. | 35 SynapticsLibraryImpl() {} |
| 20 static SynapticsLibrary* Get(); | 36 virtual ~SynapticsLibraryImpl() {} |
| 21 | 37 |
| 22 // Sets a boolean parameter. The actual call will be run on the FILE thread. | 38 // SynapticsLibrary overrides. |
| 23 void SetBoolParameter(SynapticsParameter param, bool value); | 39 virtual void SetBoolParameter(SynapticsParameter param, bool value); |
| 24 | 40 virtual void SetRangeParameter(SynapticsParameter param, int value); |
| 25 // Sets a range parameter. The actual call will be run on the FILE thread. | |
| 26 // Value should be between 1 and 10 inclusive. | |
| 27 void SetRangeParameter(SynapticsParameter param, int value); | |
| 28 | 41 |
| 29 private: | 42 private: |
| 30 friend struct DefaultSingletonTraits<SynapticsLibrary>; | |
| 31 | |
| 32 SynapticsLibrary() {} | |
| 33 ~SynapticsLibrary() {} | |
| 34 | 43 |
| 35 // This helper methods calls into the libcros library to set the parameter. | 44 // This helper methods calls into the libcros library to set the parameter. |
| 36 // This call is run on the FILE thread. | 45 // This call is run on the FILE thread. |
| 37 void SetParameter(SynapticsParameter param, int value); | 46 void SetParameter(SynapticsParameter param, int value); |
| 38 | 47 |
| 39 DISALLOW_COPY_AND_ASSIGN(SynapticsLibrary); | 48 DISALLOW_COPY_AND_ASSIGN(SynapticsLibraryImpl); |
| 40 }; | 49 }; |
| 41 | 50 |
| 42 } // namespace chromeos | 51 } // namespace chromeos |
| 43 | 52 |
| 44 #endif // CHROME_BROWSER_CHROMEOS_CROS_SYNAPTICS_LIBRARY_H_ | 53 #endif // CHROME_BROWSER_CHROMEOS_CROS_SYNAPTICS_LIBRARY_H_ |
| OLD | NEW |