Commit 456ff15f authored by Harry Cutts's avatar Harry Cutts Committed by Commit Bot

Chrome OS: Add getter for GesturePropertiesService

This will be used by a D-Bus service to allow developers to tweak
gesture properties at run-time. See
go/cros-gesture-properties-dbus-design (Google internal only, sorry) for
more details about the full design.

Some of this code is based on Jacek Fedoryński's
https://crrev.com/c/1350982.

Bug: 952054
Test: As part of a series, tested that the D-Bus service can get and set
properties. Alone, checked that Chromium and unit tests build.

Change-Id: Icf0e82e02b5aa6dcdc4efc258292fc63d208e4e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1589445
Commit-Queue: Harry Cutts <hcutts@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665326}
parent 5420be83
...@@ -179,6 +179,12 @@ void InputControllerEvdev::GetTouchEventLog(const base::FilePath& out_dir, ...@@ -179,6 +179,12 @@ void InputControllerEvdev::GetTouchEventLog(const base::FilePath& out_dir,
std::move(reply).Run(std::vector<base::FilePath>()); std::move(reply).Run(std::vector<base::FilePath>());
} }
void InputControllerEvdev::GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request) {
if (input_device_factory_)
input_device_factory_->GetGesturePropertiesService(std::move(request));
}
void InputControllerEvdev::ScheduleUpdateDeviceSettings() { void InputControllerEvdev::ScheduleUpdateDeviceSettings() {
if (!input_device_factory_ || settings_update_pending_) if (!input_device_factory_ || settings_update_pending_)
return; return;
......
...@@ -67,6 +67,8 @@ class EVENTS_OZONE_EVDEV_EXPORT InputControllerEvdev : public InputController { ...@@ -67,6 +67,8 @@ class EVENTS_OZONE_EVDEV_EXPORT InputControllerEvdev : public InputController {
void SetTouchscreensEnabled(bool enabled) override; void SetTouchscreensEnabled(bool enabled) override;
void SetInternalKeyboardFilter(bool enable_filter, void SetInternalKeyboardFilter(bool enable_filter,
std::vector<DomCode> allowed_keys) override; std::vector<DomCode> allowed_keys) override;
void GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request) override;
private: private:
// Post task to update settings. // Post task to update settings.
......
...@@ -295,6 +295,14 @@ void InputDeviceFactoryEvdev::GetTouchEventLog( ...@@ -295,6 +295,14 @@ void InputDeviceFactoryEvdev::GetTouchEventLog(
#endif #endif
} }
void InputDeviceFactoryEvdev::GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request) {
#if defined(USE_EVDEV_GESTURES)
gesture_properties_service_ = std::make_unique<GesturePropertiesService>(
gesture_property_provider_.get(), std::move(request));
#endif
}
base::WeakPtr<InputDeviceFactoryEvdev> InputDeviceFactoryEvdev::GetWeakPtr() { base::WeakPtr<InputDeviceFactoryEvdev> InputDeviceFactoryEvdev::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr(); return weak_ptr_factory_.GetWeakPtr();
} }
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include "ui/events/ozone/evdev/input_device_settings_evdev.h" #include "ui/events/ozone/evdev/input_device_settings_evdev.h"
#include "ui/ozone/public/input_controller.h" #include "ui/ozone/public/input_controller.h"
#if defined(USE_EVDEV_GESTURES)
#include "ui/events/ozone/chromeos/gesture_properties_service.h"
#endif
namespace ui { namespace ui {
class CursorDelegateEvdev; class CursorDelegateEvdev;
...@@ -62,6 +66,9 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev { ...@@ -62,6 +66,9 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
void GetTouchEventLog(const base::FilePath& out_dir, void GetTouchEventLog(const base::FilePath& out_dir,
InputController::GetTouchEventLogReply reply); InputController::GetTouchEventLogReply reply);
void GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request);
base::WeakPtr<InputDeviceFactoryEvdev> GetWeakPtr(); base::WeakPtr<InputDeviceFactoryEvdev> GetWeakPtr();
private: private:
...@@ -106,6 +113,7 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev { ...@@ -106,6 +113,7 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
#if defined(USE_EVDEV_GESTURES) #if defined(USE_EVDEV_GESTURES)
// Gesture library property provider (used by touchpads/mice). // Gesture library property provider (used by touchpads/mice).
std::unique_ptr<GesturePropertyProvider> gesture_property_provider_; std::unique_ptr<GesturePropertyProvider> gesture_property_provider_;
std::unique_ptr<GesturePropertiesService> gesture_properties_service_;
#endif #endif
// Dispatcher for events. // Dispatcher for events.
......
...@@ -98,4 +98,12 @@ void InputDeviceFactoryEvdevProxy::GetTouchEventLog( ...@@ -98,4 +98,12 @@ void InputDeviceFactoryEvdevProxy::GetTouchEventLog(
std::move(reply)))); std::move(reply))));
} }
void InputDeviceFactoryEvdevProxy::GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request) {
task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&InputDeviceFactoryEvdev::GetGesturePropertiesService,
input_device_factory_, std::move(request)));
}
} // namespace ui } // namespace ui
...@@ -46,6 +46,8 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdevProxy { ...@@ -46,6 +46,8 @@ class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdevProxy {
void GetTouchDeviceStatus(InputController::GetTouchDeviceStatusReply reply); void GetTouchDeviceStatus(InputController::GetTouchDeviceStatusReply reply);
void GetTouchEventLog(const base::FilePath& out_dir, void GetTouchEventLog(const base::FilePath& out_dir,
InputController::GetTouchEventLogReply reply); InputController::GetTouchEventLogReply reply);
void GetGesturePropertiesService(
ozone::mojom::GesturePropertiesServiceRequest request);
private: private:
scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
......
...@@ -117,6 +117,7 @@ jumbo_component("ozone_base") { ...@@ -117,6 +117,7 @@ jumbo_component("ozone_base") {
"//ui/gfx/ipc/geometry", "//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia", "//ui/gfx/ipc/skia",
"//ui/gl", "//ui/gl",
"//ui/ozone/public/interfaces:gesture_properties_service",
] ]
if (enable_vulkan) { if (enable_vulkan) {
......
...@@ -56,6 +56,8 @@ class StubInputController : public InputController { ...@@ -56,6 +56,8 @@ class StubInputController : public InputController {
void SetTouchscreensEnabled(bool enabled) override {} void SetTouchscreensEnabled(bool enabled) override {}
void SetInternalKeyboardFilter(bool enable_filter, void SetInternalKeyboardFilter(bool enable_filter,
std::vector<DomCode> allowed_keys) override {} std::vector<DomCode> allowed_keys) override {}
void GetGesturePropertiesService(
ui::ozone::mojom::GesturePropertiesServiceRequest request) override {}
private: private:
DISALLOW_COPY_AND_ASSIGN(StubInputController); DISALLOW_COPY_AND_ASSIGN(StubInputController);
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/ozone/ozone_base_export.h" #include "ui/ozone/ozone_base_export.h"
#include "ui/ozone/public/interfaces/gesture_properties_service.mojom.h"
namespace base { namespace base {
class TimeDelta; class TimeDelta;
...@@ -88,6 +89,9 @@ class OZONE_BASE_EXPORT InputController { ...@@ -88,6 +89,9 @@ class OZONE_BASE_EXPORT InputController {
virtual void SetInternalKeyboardFilter(bool enable_filter, virtual void SetInternalKeyboardFilter(bool enable_filter,
std::vector<DomCode> allowed_keys) = 0; std::vector<DomCode> allowed_keys) = 0;
virtual void GetGesturePropertiesService(
ui::ozone::mojom::GesturePropertiesServiceRequest request) = 0;
private: private:
DISALLOW_COPY_AND_ASSIGN(InputController); DISALLOW_COPY_AND_ASSIGN(InputController);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment