| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/input_device_settings.h" | 5 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 6 | 6 |
| 7 #include <stdarg.h> | 7 #include <stdarg.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 namespace system { | 24 namespace system { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const char kTpControl[] = "/opt/google/touchpad/tpcontrol"; | 28 const char kTpControl[] = "/opt/google/touchpad/tpcontrol"; |
| 29 const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; | 29 const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; |
| 30 | 30 |
| 31 bool ScriptExists(const std::string& script) { | 31 bool ScriptExists(const std::string& script) { |
| 32 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 32 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 33 return file_util::PathExists(base::FilePath(script)); | 33 return base::PathExists(base::FilePath(script)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Executes the input control script asynchronously, if it exists. | 36 // Executes the input control script asynchronously, if it exists. |
| 37 void ExecuteScriptOnFileThread(const std::vector<std::string>& argv) { | 37 void ExecuteScriptOnFileThread(const std::vector<std::string>& argv) { |
| 38 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 38 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 39 DCHECK(!argv.empty()); | 39 DCHECK(!argv.empty()); |
| 40 const std::string& script(argv[0]); | 40 const std::string& script(argv[0]); |
| 41 | 41 |
| 42 // Script must exist on device. | 42 // Script must exist on device. |
| 43 DCHECK(!base::chromeos::IsRunningOnChromeOS() || ScriptExists(script)); | 43 DCHECK(!base::chromeos::IsRunningOnChromeOS() || ScriptExists(script)); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 void SetPrimaryButtonRight(bool right) { | 155 void SetPrimaryButtonRight(bool right) { |
| 156 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 156 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 157 ExecuteScript(3, kMouseControl, "swap_left_right", right ? "1" : "0"); | 157 ExecuteScript(3, kMouseControl, "swap_left_right", right ? "1" : "0"); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace mouse_settings | 160 } // namespace mouse_settings |
| 161 | 161 |
| 162 } // namespace system | 162 } // namespace system |
| 163 } // namespace chromeos | 163 } // namespace chromeos |
| OLD | NEW |