blob: 3cf22c4fca5f6c8b49569dd8a8730d578bc556f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/cros/synaptics_library.h"
#include "base/message_loop.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
namespace chromeos {
// static
SynapticsLibrary* SynapticsLibrary::Get() {
return Singleton<SynapticsLibrary>::get();
}
void SynapticsLibrary::SetBoolParameter(SynapticsParameter param, bool value) {
SetParameter(param, value ? 1 : 0);
}
void SynapticsLibrary::SetRangeParameter(SynapticsParameter param, int value) {
if (value < 1)
value = 1;
if (value > 10)
value = 10;
SetParameter(param, value);
}
void SynapticsLibrary::SetParameter(SynapticsParameter param, int value) {
if (CrosLibrary::EnsureLoaded()) {
// This calls SetSynapticsParameter in the cros library which is
// potentially time consuming. So we run this on the FILE thread.
ChromeThread::PostTask(
ChromeThread::FILE, FROM_HERE,
NewRunnableFunction(&SetSynapticsParameter, param, value));
}
}
} // namespace chromeos
|