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

Side by Side 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: add missing system_options.html file 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/system/touchpad_settings.h" 5 #include "chrome/browser/chromeos/system/touchpad_settings.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "chrome/browser/chromeos/system/runtime_environment.h" 14 #include "chrome/browser/chromeos/system/runtime_environment.h"
15 #include "content/browser/browser_thread.h" 15 #include "content/browser/browser_thread.h"
16 16
17 namespace chromeos { 17 namespace chromeos {
18 namespace system { 18 namespace system {
19 namespace touchpad_settings { 19 namespace touchpad_settings {
20 namespace { 20 namespace {
21 const char* kTpControl = "/opt/google/touchpad/tpcontrol"; 21 const char* kTpControl = "/opt/google/touchpad/tpcontrol";
22 } // namespace
23 22
24 // Launches the tpcontrol command asynchronously, if it exists. 23 // Launches the tpcontrol command asynchronously, if it exists.
25 void LaunchTpControl(const std::vector<std::string>& argv) { 24 void LaunchTpControl(const std::vector<std::string>& argv) {
26 if (!system::runtime_environment::IsRunningOnChromeOS()) { 25 if (!TouchpadExists())
27 // Do nothing on Linux desktop, as the command does not exist.
28 return; 26 return;
29 }
30
31 if (!file_util::PathExists(FilePath(argv[0]))) {
32 LOG(ERROR) << argv[0] << " not found";
33 return;
34 }
35 27
36 base::LaunchOptions options; 28 base::LaunchOptions options;
37 options.wait = false; // Launch asynchronously. 29 options.wait = false; // Launch asynchronously.
38 30
39 base::LaunchProcess(CommandLine(argv), options, NULL); 31 base::LaunchProcess(CommandLine(argv), options, NULL);
40 } 32 }
41 33
34 } // namespace
35
36 bool TouchpadExists() {
37 // Do nothing on Linux desktop, as the command does not exist.
38 return system::runtime_environment::IsRunningOnChromeOS() &&
39 file_util::PathExists(FilePath(kTpControl));
DaveMoore 2011/10/13 00:04:43 This file exists even on devices with no touchpad.
achuithb 2011/10/13 00:06:44 How do you tell if there's no touchpad then?
40 }
41
42 void SetSensitivity(int value) { 42 void SetSensitivity(int value) {
43 // Run this on the FILE thread. 43 // Run this on the FILE thread.
44 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) { 44 if (!BrowserThread::CurrentlyOn(BrowserThread::FILE)) {
45 BrowserThread::PostTask( 45 BrowserThread::PostTask(
46 BrowserThread::FILE, FROM_HERE, 46 BrowserThread::FILE, FROM_HERE,
47 base::Bind(&SetSensitivity, value)); 47 base::Bind(&SetSensitivity, value));
48 return; 48 return;
49 } 49 }
50 50
51 std::vector<std::string> argv; 51 std::vector<std::string> argv;
(...skipping 17 matching lines...) Expand all
69 argv.push_back(kTpControl); 69 argv.push_back(kTpControl);
70 argv.push_back("taptoclick"); 70 argv.push_back("taptoclick");
71 argv.push_back(enabled ? "on" : "off"); 71 argv.push_back(enabled ? "on" : "off");
72 72
73 LaunchTpControl(argv); 73 LaunchTpControl(argv);
74 } 74 }
75 75
76 } // namespace touchpad_settings 76 } // namespace touchpad_settings
77 } // namespace system 77 } // namespace system
78 } // namespace chromeos 78 } // namespace chromeos
OLDNEW
« 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