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