summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 21:26:02 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 21:26:02 +0000
commit9cf57bc6f88c6002be00b488e08c78c7cb279b31 (patch)
treec9bf26f9f86bdb99b88893e256699981f03a14ca /chrome/browser
parent0bc6d01bddac7cd28519c2d312d54e06b1ceec61 (diff)
downloadchromium_src-9cf57bc6f88c6002be00b488e08c78c7cb279b31.zip
chromium_src-9cf57bc6f88c6002be00b488e08c78c7cb279b31.tar.gz
chromium_src-9cf57bc6f88c6002be00b488e08c78c7cb279b31.tar.bz2
Get rid of use of functions from chromeos_touchpad.h.
This is part of the libcros removal effort. chromeos_touchpad.cc just executes a program called tpcontrol. We can easily move the code from libcros to chrome. In the next patch, we'll be moving this code out of chromeos/cros. TEST="touchpad pointer speed" setting just worked as before. BUG=chromium-os:16562 Review URL: http://codereview.chromium.org/7328009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/cros/touchpad_library.cc44
-rw-r--r--chrome/browser/chromeos/cros/touchpad_library.h4
2 files changed, 39 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/cros/touchpad_library.cc b/chrome/browser/chromeos/cros/touchpad_library.cc
index 2b01a01..ce849d8 100644
--- a/chrome/browser/chromeos/cros/touchpad_library.cc
+++ b/chrome/browser/chromeos/cros/touchpad_library.cc
@@ -1,14 +1,19 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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/touchpad_library.h"
+#include "base/command_line.h"
#include "base/message_loop.h"
-#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "base/process_util.h"
+#include "base/stringprintf.h"
#include "content/browser/browser_thread.h"
namespace chromeos {
+namespace {
+const char* kTpControl = "/opt/google/touchpad/tpcontrol";
+} // namespace
class TouchpadLibraryImpl : public TouchpadLibrary {
public:
@@ -16,19 +21,43 @@ class TouchpadLibraryImpl : public TouchpadLibrary {
virtual ~TouchpadLibraryImpl() {}
void SetSensitivity(int value) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
+ // Run this on the FILE thread.
+ if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- NewRunnableFunction(&SetTouchpadSensitivity, value));
+ NewRunnableMethod(this,
+ &TouchpadLibraryImpl::SetSensitivity, value));
+ return;
}
+ std::vector<std::string> argv;
+ argv.push_back(kTpControl);
+ argv.push_back("sensitivity");
+ argv.push_back(StringPrintf("%d", value));
+
+ base::LaunchOptions options;
+ options.wait = false; // Launch asynchronously.
+
+ base::LaunchProcess(CommandLine(argv), options);
}
void SetTapToClick(bool enabled) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
+ // Run this on the FILE thread.
+ if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
- NewRunnableFunction(&SetTouchpadTapToClick, enabled));
+ NewRunnableMethod(this,
+ &TouchpadLibraryImpl::SetTapToClick, enabled));
+ return;
}
+ std::vector<std::string> argv;
+ argv.push_back(kTpControl);
+ argv.push_back("taptoclick");
+ argv.push_back(enabled ? "on" : "off");
+
+ base::LaunchOptions options;
+ options.wait = false; // Launch asynchronously.
+
+ base::LaunchProcess(CommandLine(argv), options);
}
DISALLOW_COPY_AND_ASSIGN(TouchpadLibraryImpl);
@@ -54,3 +83,6 @@ TouchpadLibrary* TouchpadLibrary::GetImpl(bool stub) {
}
} // namespace chromeos
+
+// Needed for NewRunnableMethod() call above.
+DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::TouchpadLibraryImpl);
diff --git a/chrome/browser/chromeos/cros/touchpad_library.h b/chrome/browser/chromeos/cros/touchpad_library.h
index 09c23ef..b4ae088 100644
--- a/chrome/browser/chromeos/cros/touchpad_library.h
+++ b/chrome/browser/chromeos/cros/touchpad_library.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,8 +6,6 @@
#define CHROME_BROWSER_CHROMEOS_CROS_TOUCHPAD_LIBRARY_H_
#pragma once
-#include "third_party/cros/chromeos_touchpad.h"
-
namespace chromeos {
// This interface defines interaction with the ChromeOS synaptics library APIs.