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

Unified Diff: chrome/browser/chromeos/system/touchpad_settings.cc

Issue 8249011: Remove 'Enable tap-to-click' checkbox for non-touchpad devices. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: cleanup TouchpadSettings interface Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/system/touchpad_settings.cc
===================================================================
--- chrome/browser/chromeos/system/touchpad_settings.cc (revision 106949)
+++ chrome/browser/chromeos/system/touchpad_settings.cc (working copy)
@@ -19,24 +19,40 @@
namespace touchpad_settings {
namespace {
const char* kTpControl = "/opt/google/touchpad/tpcontrol";
-} // namespace
+bool TPCtrlExists() {
+ return file_util::PathExists(FilePath(kTpControl));
+}
+
// Launches the tpcontrol command asynchronously, if it exists.
void LaunchTpControl(const std::vector<std::string>& argv) {
- if (!system::runtime_environment::IsRunningOnChromeOS()) {
- // Do nothing on Linux desktop, as the command does not exist.
+ if (!TPCtrlExists())
return;
- }
- if (!file_util::PathExists(FilePath(argv[0]))) {
- LOG(ERROR) << argv[0] << " not found";
- return;
- }
+ base::LaunchProcess(CommandLine(argv), base::LaunchOptions(), NULL);
+}
- base::LaunchOptions options;
- options.wait = false; // Launch asynchronously.
+} // namespace
- base::LaunchProcess(CommandLine(argv), options, NULL);
+bool TouchpadExists() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ static bool init = false;
+ static bool exists = false;
+
+ if (init)
+ return exists;
+
+ init = true;
+ if (!TPCtrlExists())
+ return exists;
+
+ std::vector<std::string> argv;
+ argv.push_back(kTpControl);
+ argv.push_back("status");
+ std::string output;
+ // On devices with no touchpad, output is empty.
+ exists = base::GetAppOutput(CommandLine(argv), &output) && !output.empty();
+ return exists;
}
void SetSensitivity(int value) {
« no previous file with comments | « chrome/browser/chromeos/system/touchpad_settings.h ('k') | chrome/browser/resources/options/chromeos/system_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698