| 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..10cc5a652d387e065261a971da19cd271d510ccf 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 kDeviceTypeTouchpad[] = "touchpad";
|
| +const char kDeviceTypeMouse[] = "mouse";
|
| +const char kInputControl[] = "/opt/google/input/inputcontrol";
|
|
|
| const char kRemoraRequisition[] = "remora";
|
|
|
| @@ -81,34 +82,35 @@ 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* device_type, int value,
|
| + 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",
|
| + device_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* device_type,
|
| 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", device_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:" << device_type << "=" << exists->data;
|
| }
|
|
|
| void RunCallbackUIThread(
|
| @@ -168,7 +170,7 @@ InputDeviceSettingsImpl::InputDeviceSettingsImpl() {}
|
|
|
| void InputDeviceSettingsImpl::TouchpadExists(
|
| const DeviceExistsCallback& callback) {
|
| - DeviceExists(kTpControl, callback);
|
| + DeviceExists(kDeviceTypeTouchpad, callback);
|
| }
|
|
|
| void InputDeviceSettingsImpl::UpdateTouchpadSettings(
|
| @@ -206,7 +208,7 @@ void InputDeviceSettingsImpl::SetTapDragging(bool enabled) {
|
| void InputDeviceSettingsImpl::MouseExists(
|
| const DeviceExistsCallback& callback) {
|
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| - DeviceExists(kMouseControl, callback);
|
| + DeviceExists(kDeviceTypeMouse, callback);
|
| }
|
|
|
| void InputDeviceSettingsImpl::UpdateMouseSettings(const MouseSettings& update) {
|
| @@ -313,17 +315,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(kDeviceTypeTouchpad, 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 +337,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 +371,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(kDeviceTypeMouse, 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;
|
|
|