| 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 #include "chrome/browser/chromeos/cros/synaptics_library.h" | 5 #include "chrome/browser/chromeos/cros/synaptics_library.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 // static | 13 void SynapticsLibraryImpl::SetBoolParameter(SynapticsParameter param, |
| 14 SynapticsLibrary* SynapticsLibrary::Get() { | 14 bool value) { |
| 15 return Singleton<SynapticsLibrary>::get(); | |
| 16 } | |
| 17 | |
| 18 void SynapticsLibrary::SetBoolParameter(SynapticsParameter param, bool value) { | |
| 19 SetParameter(param, value ? 1 : 0); | 15 SetParameter(param, value ? 1 : 0); |
| 20 } | 16 } |
| 21 | 17 |
| 22 void SynapticsLibrary::SetRangeParameter(SynapticsParameter param, int value) { | 18 void SynapticsLibraryImpl::SetRangeParameter(SynapticsParameter param, |
| 19 int value) { |
| 23 if (value < 1) | 20 if (value < 1) |
| 24 value = 1; | 21 value = 1; |
| 25 if (value > 10) | 22 if (value > 10) |
| 26 value = 10; | 23 value = 10; |
| 27 SetParameter(param, value); | 24 SetParameter(param, value); |
| 28 } | 25 } |
| 29 | 26 |
| 30 void SynapticsLibrary::SetParameter(SynapticsParameter param, int value) { | 27 void SynapticsLibraryImpl::SetParameter(SynapticsParameter param, int value) { |
| 31 if (CrosLibrary::EnsureLoaded()) { | 28 if (CrosLibrary::Get()->EnsureLoaded()) { |
| 32 // This calls SetSynapticsParameter in the cros library which is | 29 // This calls SetSynapticsParameter in the cros library which is |
| 33 // potentially time consuming. So we run this on the FILE thread. | 30 // potentially time consuming. So we run this on the FILE thread. |
| 34 ChromeThread::PostTask( | 31 ChromeThread::PostTask( |
| 35 ChromeThread::FILE, FROM_HERE, | 32 ChromeThread::FILE, FROM_HERE, |
| 36 NewRunnableFunction(&SetSynapticsParameter, param, value)); | 33 NewRunnableFunction(&SetSynapticsParameter, param, value)); |
| 37 } | 34 } |
| 38 } | 35 } |
| 39 | 36 |
| 40 } // namespace chromeos | 37 } // namespace chromeos |
| OLD | NEW |