Chromium Code Reviews| Index: chrome/browser/chromeos/system/input_device_settings.cc |
| diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc |
| index c377025a97e98a0f10099aa3905f691443aafb94..d3082aaddbe400187325ce0b5f351ace55c50b72 100644 |
| --- a/chrome/browser/chromeos/system/input_device_settings.cc |
| +++ b/chrome/browser/chromeos/system/input_device_settings.cc |
| @@ -33,8 +33,9 @@ namespace { |
| InputDeviceSettings* g_instance_; |
| InputDeviceSettings* g_test_instance_; |
| -const char kTpControl[] = "/opt/google/touchpad/tpcontrol"; |
| -const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; |
| +const char kTouchpad[] = "touchpad"; |
|
achuithb
2014/03/27 00:18:49
kDeviceTypeTouchpad
denniskempin (chromium)
2014/03/27 17:36:58
Done.
|
| +const char kMouse[] = "mouse"; |
|
achuithb
2014/03/27 00:18:49
kDeviceTypeMouse
denniskempin (chromium)
2014/03/27 17:36:58
Done.
|
| +const char kInputControl[] = "/opt/google/input/inputcontrol"; |
| const char kRemoraRequisition[] = "remora"; |
| @@ -81,34 +82,34 @@ void ExecuteScript(const std::vector<std::string>& argv) { |
| runner->PostTask(FROM_HERE, base::Bind(&ExecuteScriptOnFileThread, argv)); |
| } |
| -void AddSensitivityArguments(int value, std::vector<std::string>* argv) { |
| +void AddSensitivityArguments(const char* type, int value, |
|
achuithb
2014/03/27 00:18:49
type is too general - let's call this device_type.
denniskempin (chromium)
2014/03/27 17:36:58
Done.
|
| + std::vector<std::string>* argv) { |
| DCHECK(value >= kMinPointerSensitivity && value <= kMaxPointerSensitivity); |
| - argv->push_back("sensitivity"); |
| - argv->push_back(base::StringPrintf("%d", value)); |
| + argv->push_back(base::StringPrintf("--%s_sensitivity=%d", type, value)); |
| } |
| void AddTPControlArguments(const char* control, |
| bool enabled, |
| std::vector<std::string>* argv) { |
| - argv->push_back(control); |
| - argv->push_back(enabled ? "on" : "off"); |
| + argv->push_back(base::StringPrintf("--%s=%d", control, enabled ? 1 : 0)); |
| } |
| -void DeviceExistsBlockingPool(const char* script, |
| +void DeviceExistsBlockingPool(const char* type, |
|
achuithb
2014/03/27 00:18:49
device_type
denniskempin (chromium)
2014/03/27 17:36:58
Done.
|
| scoped_refptr<RefCountedBool> exists) { |
| DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| exists->data = false; |
| - if (!ScriptExists(script)) |
| + if (!ScriptExists(kInputControl)) |
| return; |
| std::vector<std::string> argv; |
| - argv.push_back(script); |
| - argv.push_back("status"); |
| + argv.push_back(kInputControl); |
| + argv.push_back(base::StringPrintf("--type=%s", type)); |
| + argv.push_back("--list"); |
| std::string output; |
| // Output is empty if the device is not found. |
| exists->data = base::GetAppOutput(CommandLine(argv), &output) && |
| !output.empty(); |
| - DVLOG(1) << "DeviceExistsBlockingPool:" << script << "=" << exists->data; |
| + DVLOG(1) << "DeviceExistsBlockingPool:" << type << "=" << exists->data; |
| } |
| void RunCallbackUIThread( |
| @@ -168,7 +169,7 @@ InputDeviceSettingsImpl::InputDeviceSettingsImpl() {} |
| void InputDeviceSettingsImpl::TouchpadExists( |
| const DeviceExistsCallback& callback) { |
| - DeviceExists(kTpControl, callback); |
| + DeviceExists(kTouchpad, callback); |
| } |
| void InputDeviceSettingsImpl::UpdateTouchpadSettings( |
| @@ -206,7 +207,7 @@ void InputDeviceSettingsImpl::SetTapDragging(bool enabled) { |
| void InputDeviceSettingsImpl::MouseExists( |
| const DeviceExistsCallback& callback) { |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| - DeviceExists(kMouseControl, callback); |
| + DeviceExists(kMouse, callback); |
| } |
| void InputDeviceSettingsImpl::UpdateMouseSettings(const MouseSettings& update) { |
| @@ -313,17 +314,17 @@ bool TouchpadSettings::GetTapDragging() const { |
| bool TouchpadSettings::Update(const TouchpadSettings& settings, |
| std::vector<std::string>* argv) { |
| if (argv) |
| - argv->push_back(kTpControl); |
| + argv->push_back(kInputControl); |
| bool updated = false; |
| if (sensitivity_.Update(settings.sensitivity_)) { |
| updated = true; |
| if (argv) |
| - AddSensitivityArguments(sensitivity_.value(), argv); |
| + AddSensitivityArguments(kTouchpad, sensitivity_.value(), argv); |
| } |
| if (tap_to_click_.Update(settings.tap_to_click_)) { |
| updated = true; |
| if (argv) |
| - AddTPControlArguments("taptoclick", tap_to_click_.value(), argv); |
| + AddTPControlArguments("tapclick", tap_to_click_.value(), argv); |
| } |
| if (three_finger_click_.Update(settings.three_finger_click_)) { |
| updated = true; |
| @@ -335,7 +336,7 @@ bool TouchpadSettings::Update(const TouchpadSettings& settings, |
| if (tap_dragging_.Update(settings.tap_dragging_)) { |
| updated = true; |
| if (argv) |
| - AddTPControlArguments("tap_dragging", tap_dragging_.value(), argv); |
| + AddTPControlArguments("tapdrag", tap_dragging_.value(), argv); |
| } |
| return updated; |
| } |
| @@ -369,18 +370,18 @@ bool MouseSettings::GetPrimaryButtonRight() const { |
| bool MouseSettings::Update(const MouseSettings& settings, |
| std::vector<std::string>* argv) { |
| if (argv) |
| - argv->push_back(kMouseControl); |
| + argv->push_back(kInputControl); |
| bool updated = false; |
| if (sensitivity_.Update(settings.sensitivity_)) { |
| updated = true; |
| if (argv) |
| - AddSensitivityArguments(sensitivity_.value(), argv); |
| + AddSensitivityArguments(kMouse, sensitivity_.value(), argv); |
| } |
| if (primary_button_right_.Update(settings.primary_button_right_)) { |
| updated = true; |
| if (argv) { |
| - argv->push_back("swap_left_right"); |
| - argv->push_back(settings.GetPrimaryButtonRight() ? "1" : "0"); |
| + AddTPControlArguments("mouse_swap_lr", primary_button_right_.value(), |
| + argv); |
| } |
| } |
| return updated; |