• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #include "chrome/browser/chromeos/cros/touchpad_library.h"
6 
7 #include "base/message_loop.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "content/browser/browser_thread.h"
10 
11 namespace chromeos {
12 
13 class TouchpadLibraryImpl : public TouchpadLibrary {
14  public:
TouchpadLibraryImpl()15   TouchpadLibraryImpl() {}
~TouchpadLibraryImpl()16   virtual ~TouchpadLibraryImpl() {}
17 
SetSensitivity(int value)18   void SetSensitivity(int value) {
19     if (CrosLibrary::Get()->EnsureLoaded()) {
20       BrowserThread::PostTask(
21           BrowserThread::FILE, FROM_HERE,
22           NewRunnableFunction(&SetTouchpadSensitivity, value));
23     }
24   }
25 
SetTapToClick(bool enabled)26   void SetTapToClick(bool enabled) {
27     if (CrosLibrary::Get()->EnsureLoaded()) {
28       BrowserThread::PostTask(
29           BrowserThread::FILE, FROM_HERE,
30           NewRunnableFunction(&SetTouchpadTapToClick, enabled));
31     }
32   }
33 
34   DISALLOW_COPY_AND_ASSIGN(TouchpadLibraryImpl);
35 };
36 
37 class TouchpadLibraryStubImpl : public TouchpadLibrary {
38  public:
TouchpadLibraryStubImpl()39   TouchpadLibraryStubImpl() {}
~TouchpadLibraryStubImpl()40   virtual ~TouchpadLibraryStubImpl() {}
SetSensitivity(int value)41   void SetSensitivity(int value) {}
SetTapToClick(bool enabled)42   void SetTapToClick(bool enabled) {}
43 
44  private:
45   DISALLOW_COPY_AND_ASSIGN(TouchpadLibraryStubImpl);
46 };
47 
48 // static
GetImpl(bool stub)49 TouchpadLibrary* TouchpadLibrary::GetImpl(bool stub) {
50   if (stub)
51     return new TouchpadLibraryStubImpl();
52   else
53     return new TouchpadLibraryImpl();
54 }
55 
56 }  // namespace chromeos
57