Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1451)

Side by Side Diff: chrome/browser/chromeos/cros/synaptics_library.cc

Issue 1142005: Mocks for all libcros elements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/synaptics_library.h ('k') | chrome/browser/chromeos/google_update_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698