Commit 2f68b6fe authored by sky's avatar sky Committed by Commit bot

chromeos: moves setting of touch state to a separate class

For mash/mushrome we need setting of touch state to happen in
mus. This patch separates out setting into a separate class so that
ash in mus/mash can plug in a class that makes mojo calls.

BUG=705686
TEST=covered by tests
R=oshima@chromium.org

Review-Url: https://codereview.chromium.org/2887413004
Cr-Commit-Position: refs/heads/master@{#473474}
parent 97853258
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h" #include "ui/compositor/layer_animator.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/manager/chromeos/default_touch_transform_setter.h"
#include "ui/display/manager/chromeos/display_change_observer.h" #include "ui/display/manager/chromeos/display_change_observer.h"
#include "ui/display/manager/chromeos/display_configurator.h" #include "ui/display/manager/chromeos/display_configurator.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
...@@ -1059,7 +1060,8 @@ void Shell::Init(const ShellInitParams& init_params) { ...@@ -1059,7 +1060,8 @@ void Shell::Init(const ShellInitParams& init_params) {
// TODO(sky): needs to to work for mus too. // TODO(sky): needs to to work for mus too.
if (config == Config::CLASSIC) { if (config == Config::CLASSIC) {
touch_transformer_controller_.reset(new AshTouchTransformController( touch_transformer_controller_.reset(new AshTouchTransformController(
display_configurator_.get(), display_manager_.get())); display_configurator_.get(), display_manager_.get(),
base::MakeUnique<display::DefaultTouchTransformSetter>()));
} }
keyboard_ui_ = shell_port_->CreateKeyboardUI(); keyboard_ui_ = shell_port_->CreateKeyboardUI();
......
...@@ -5,14 +5,18 @@ ...@@ -5,14 +5,18 @@
#include "ash/touch/ash_touch_transform_controller.h" #include "ash/touch/ash_touch_transform_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ui/display/manager/chromeos/touch_transform_setter.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
namespace ash { namespace ash {
AshTouchTransformController::AshTouchTransformController( AshTouchTransformController::AshTouchTransformController(
display::DisplayConfigurator* display_configurator, display::DisplayConfigurator* display_configurator,
display::DisplayManager* display_manager) display::DisplayManager* display_manager,
: TouchTransformController(display_configurator, display_manager) { std::unique_ptr<display::TouchTransformSetter> setter)
: TouchTransformController(display_configurator,
display_manager,
std::move(setter)) {
Shell::Get()->window_tree_host_manager()->AddObserver(this); Shell::Get()->window_tree_host_manager()->AddObserver(this);
} }
......
...@@ -25,7 +25,8 @@ class ASH_EXPORT AshTouchTransformController ...@@ -25,7 +25,8 @@ class ASH_EXPORT AshTouchTransformController
public: public:
AshTouchTransformController( AshTouchTransformController(
display::DisplayConfigurator* display_configurator, display::DisplayConfigurator* display_configurator,
display::DisplayManager* display_manager); display::DisplayManager* display_manager,
std::unique_ptr<display::TouchTransformSetter> setter);
~AshTouchTransformController() override; ~AshTouchTransformController() override;
// WindowTreeHostManager::Observer: // WindowTreeHostManager::Observer:
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/binder_registry.h"
#include "services/ui/display/output_protection.h" #include "services/ui/display/output_protection.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/display/manager/chromeos/default_touch_transform_setter.h"
#include "ui/display/manager/chromeos/display_change_observer.h" #include "ui/display/manager/chromeos/display_change_observer.h"
#include "ui/display/manager/chromeos/touch_transform_controller.h" #include "ui/display/manager/chromeos/touch_transform_controller.h"
#include "ui/display/manager/display_layout_store.h" #include "ui/display/manager/display_layout_store.h"
...@@ -165,7 +166,8 @@ void ScreenManagerOzoneInternal::Init(ScreenManagerDelegate* delegate) { ...@@ -165,7 +166,8 @@ void ScreenManagerOzoneInternal::Init(ScreenManagerDelegate* delegate) {
display_configurator_.ForceInitialConfigure(kChromeOsBootColor); display_configurator_.ForceInitialConfigure(kChromeOsBootColor);
touch_transform_controller_ = base::MakeUnique<TouchTransformController>( touch_transform_controller_ = base::MakeUnique<TouchTransformController>(
&display_configurator_, display_manager_.get()); &display_configurator_, display_manager_.get(),
base::MakeUnique<display::DefaultTouchTransformSetter>());
} }
void ScreenManagerOzoneInternal::RequestCloseDisplay(int64_t display_id) { void ScreenManagerOzoneInternal::RequestCloseDisplay(int64_t display_id) {
......
...@@ -10,6 +10,8 @@ component("manager") { ...@@ -10,6 +10,8 @@ component("manager") {
"chromeos/apply_content_protection_task.h", "chromeos/apply_content_protection_task.h",
"chromeos/configure_displays_task.cc", "chromeos/configure_displays_task.cc",
"chromeos/configure_displays_task.h", "chromeos/configure_displays_task.h",
"chromeos/default_touch_transform_setter.cc",
"chromeos/default_touch_transform_setter.h",
"chromeos/display_change_observer.cc", "chromeos/display_change_observer.cc",
"chromeos/display_change_observer.h", "chromeos/display_change_observer.h",
"chromeos/display_configurator.cc", "chromeos/display_configurator.cc",
...@@ -19,8 +21,11 @@ component("manager") { ...@@ -19,8 +21,11 @@ component("manager") {
"chromeos/display_util.h", "chromeos/display_util.h",
"chromeos/query_content_protection_task.cc", "chromeos/query_content_protection_task.cc",
"chromeos/query_content_protection_task.h", "chromeos/query_content_protection_task.h",
"chromeos/touch_device_transform.cc",
"chromeos/touch_device_transform.h",
"chromeos/touch_transform_controller.cc", "chromeos/touch_transform_controller.cc",
"chromeos/touch_transform_controller.h", "chromeos/touch_transform_controller.h",
"chromeos/touch_transform_setter.h",
"chromeos/touchscreen_util.cc", "chromeos/touchscreen_util.cc",
"chromeos/touchscreen_util.h", "chromeos/touchscreen_util.h",
"chromeos/update_display_configuration_task.cc", "chromeos/update_display_configuration_task.cc",
......
include_rules = [
# DeviceDataManager is not created in all environments (such as ash when
# running in mus/mash).
"-ui/events/devices/device_data_manager.h",
]
specific_include_rules = { specific_include_rules = {
"default_touch_transform_setter.cc": [
# DefaultTouchTransformSetter only runs in environments where
# DeviceDataManager exists.
"+ui/events/devices/device_data_manager.h",
],
"touch_transform_controller.cc": [ "touch_transform_controller.cc": [
"+third_party/skia", "+third_party/skia",
], ],
"touch_transform_controller_unittest.cc": [
"+ui/events/devices/device_data_manager.h",
],
} }
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/display/manager/chromeos/default_touch_transform_setter.h"
#include "ui/display/manager/chromeos/touch_device_transform.h"
#include "ui/events/devices/device_data_manager.h"
namespace display {
DefaultTouchTransformSetter::DefaultTouchTransformSetter() = default;
DefaultTouchTransformSetter::~DefaultTouchTransformSetter() = default;
void DefaultTouchTransformSetter::ConfigureTouchDevices(
const std::map<int32_t, double>& scales,
const std::vector<TouchDeviceTransform>& transforms) {
ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
device_manager->ClearTouchDeviceAssociations();
for (auto& device_scale_pair : scales) {
device_manager->UpdateTouchRadiusScale(device_scale_pair.first,
device_scale_pair.second);
}
for (const TouchDeviceTransform& transform : transforms) {
device_manager->UpdateTouchInfoForDisplay(
transform.display_id, transform.device_id, transform.transform);
}
}
} // namespace display
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_DISPLAY_MANAGER_CHROMEOS_DEFAULT_TOUCH_TRANSFORM_SETTER_H_
#define UI_DISPLAY_MANAGER_CHROMEOS_DEFAULT_TOUCH_TRANSFORM_SETTER_H_
#include "base/macros.h"
#include "ui/display/manager/chromeos/touch_transform_setter.h"
namespace display {
class DISPLAY_MANAGER_EXPORT DefaultTouchTransformSetter
: public TouchTransformSetter {
public:
DefaultTouchTransformSetter();
~DefaultTouchTransformSetter() override;
// TouchTransformSetter:
void ConfigureTouchDevices(
const std::map<int32_t, double>& scales,
const std::vector<TouchDeviceTransform>& transforms) override;
private:
DISALLOW_COPY_AND_ASSIGN(DefaultTouchTransformSetter);
};
} // namespace display
#endif // UI_DISPLAY_MANAGER_CHROMEOS_DEFAULT_TOUCH_TRANSFORM_SETTER_H_
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/display/manager/chromeos/touch_device_transform.h"
namespace display {
TouchDeviceTransform::TouchDeviceTransform() = default;
TouchDeviceTransform::~TouchDeviceTransform() = default;
} // namespace display
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_DEVICE_TRANSFORM_H_
#define UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_DEVICE_TRANSFORM_H_
#include <stdint.h>
#include "ui/display/manager/display_manager_export.h"
#include "ui/gfx/transform.h"
namespace display {
struct DISPLAY_MANAGER_EXPORT TouchDeviceTransform {
TouchDeviceTransform();
~TouchDeviceTransform();
int64_t display_id;
int32_t device_id;
gfx::Transform transform;
};
} // namespace display
#endif // UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_DEVICE_TRANSFORM_H_
...@@ -10,12 +10,14 @@ ...@@ -10,12 +10,14 @@
#include "third_party/skia/include/core/SkMatrix44.h" #include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/display/display_layout.h" #include "ui/display/display_layout.h"
#include "ui/display/manager/chromeos/display_configurator.h" #include "ui/display/manager/chromeos/display_configurator.h"
#include "ui/display/manager/chromeos/touch_device_transform.h"
#include "ui/display/manager/chromeos/touch_transform_setter.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
#include "ui/display/manager/managed_display_info.h" #include "ui/display/manager/managed_display_info.h"
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/display/types/display_constants.h" #include "ui/display/types/display_constants.h"
#include "ui/display/types/display_snapshot.h" #include "ui/display/types/display_snapshot.h"
#include "ui/events/devices/device_data_manager.h" #include "ui/events/devices/input_device_manager.h"
namespace display { namespace display {
...@@ -23,7 +25,7 @@ namespace { ...@@ -23,7 +25,7 @@ namespace {
ui::TouchscreenDevice FindTouchscreenById(int id) { ui::TouchscreenDevice FindTouchscreenById(int id) {
const std::vector<ui::TouchscreenDevice>& touchscreens = const std::vector<ui::TouchscreenDevice>& touchscreens =
ui::DeviceDataManager::GetInstance()->GetTouchscreenDevices(); ui::InputDeviceManager::GetInstance()->GetTouchscreenDevices();
for (const auto& touchscreen : touchscreens) { for (const auto& touchscreen : touchscreens) {
if (touchscreen.id == id) if (touchscreen.id == id)
return touchscreen; return touchscreen;
...@@ -161,6 +163,10 @@ DisplayIdList GetCurrentDisplayIdList(const DisplayManager* display_manager) { ...@@ -161,6 +163,10 @@ DisplayIdList GetCurrentDisplayIdList(const DisplayManager* display_manager) {
} // namespace } // namespace
TouchTransformController::UpdateData::UpdateData() = default;
TouchTransformController::UpdateData::~UpdateData() = default;
// This is to compute the scale ratio for the TouchEvent's radius. The // This is to compute the scale ratio for the TouchEvent's radius. The
// configured resolution of the display is not always the same as the touch // configured resolution of the display is not always the same as the touch
// screen's reporting resolution, e.g. the display could be set as // screen's reporting resolution, e.g. the display could be set as
...@@ -283,38 +289,49 @@ gfx::Transform TouchTransformController::GetTouchTransform( ...@@ -283,38 +289,49 @@ gfx::Transform TouchTransformController::GetTouchTransform(
TouchTransformController::TouchTransformController( TouchTransformController::TouchTransformController(
DisplayConfigurator* display_configurator, DisplayConfigurator* display_configurator,
DisplayManager* display_manager) DisplayManager* display_manager,
std::unique_ptr<TouchTransformSetter> setter)
: display_configurator_(display_configurator), : display_configurator_(display_configurator),
display_manager_(display_manager) {} display_manager_(display_manager),
setter_(std::move(setter)) {}
TouchTransformController::~TouchTransformController() {} TouchTransformController::~TouchTransformController() {}
void TouchTransformController::UpdateTouchTransforms() const {
UpdateData update_data;
UpdateTouchTransforms(&update_data);
setter_->ConfigureTouchDevices(update_data.device_to_scale,
update_data.touch_device_transforms);
}
void TouchTransformController::UpdateTouchRadius( void TouchTransformController::UpdateTouchRadius(
const ManagedDisplayInfo& display) const { const ManagedDisplayInfo& display,
ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); UpdateData* update_data) const {
for (const auto& device_id : display.input_devices()) { for (const auto& device_id : display.input_devices()) {
device_manager->UpdateTouchRadiusScale( DCHECK_EQ(0u, update_data->device_to_scale.count(device_id));
device_id, update_data->device_to_scale[device_id] =
GetTouchResolutionScale(display, FindTouchscreenById(device_id))); GetTouchResolutionScale(display, FindTouchscreenById(device_id));
} }
} }
void TouchTransformController::UpdateTouchTransform( void TouchTransformController::UpdateTouchTransform(
int64_t target_display_id, int64_t target_display_id,
const ManagedDisplayInfo& touch_display, const ManagedDisplayInfo& touch_display,
const ManagedDisplayInfo& target_display) const { const ManagedDisplayInfo& target_display,
ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance(); UpdateData* update_data) const {
TouchDeviceTransform touch_device_transform;
touch_device_transform.display_id = target_display_id;
gfx::Size fb_size = display_configurator_->framebuffer_size(); gfx::Size fb_size = display_configurator_->framebuffer_size();
for (const auto& device_id : touch_display.input_devices()) { for (const auto& device_id : touch_display.input_devices()) {
device_manager->UpdateTouchInfoForDisplay( touch_device_transform.device_id = device_id;
target_display_id, device_id, touch_device_transform.transform = GetTouchTransform(
GetTouchTransform(target_display, touch_display, target_display, touch_display, FindTouchscreenById(device_id), fb_size);
FindTouchscreenById(device_id), fb_size)); update_data->touch_device_transforms.push_back(touch_device_transform);
} }
} }
void TouchTransformController::UpdateTouchTransforms() const { void TouchTransformController::UpdateTouchTransforms(
ui::DeviceDataManager::GetInstance()->ClearTouchDeviceAssociations(); UpdateData* update_data) const {
if (display_manager_->num_connected_displays() == 0) if (display_manager_->num_connected_displays() == 0)
return; return;
...@@ -326,7 +343,7 @@ void TouchTransformController::UpdateTouchTransforms() const { ...@@ -326,7 +343,7 @@ void TouchTransformController::UpdateTouchTransforms() const {
for (int64_t display_id : display_id_list) { for (int64_t display_id : display_id_list) {
DCHECK(display_id != kInvalidDisplayId); DCHECK(display_id != kInvalidDisplayId);
display_info_list.push_back(display_manager_->GetDisplayInfo(display_id)); display_info_list.push_back(display_manager_->GetDisplayInfo(display_id));
UpdateTouchRadius(display_info_list.back()); UpdateTouchRadius(display_info_list.back(), update_data);
} }
if (display_manager_->IsInMirrorMode()) { if (display_manager_->IsInMirrorMode()) {
...@@ -347,14 +364,14 @@ void TouchTransformController::UpdateTouchTransforms() const { ...@@ -347,14 +364,14 @@ void TouchTransformController::UpdateTouchTransforms() const {
: index; : index;
UpdateTouchTransform(display_id_list[primary_display_id_index], UpdateTouchTransform(display_id_list[primary_display_id_index],
display_info_list[index], display_info_list[index],
display_info_list[touch_display_index]); display_info_list[touch_display_index], update_data);
} }
return; return;
} }
for (std::size_t index = 0; index < display_id_list.size(); index++) { for (std::size_t index = 0; index < display_id_list.size(); index++) {
UpdateTouchTransform(display_id_list[index], display_info_list[index], UpdateTouchTransform(display_id_list[index], display_info_list[index],
display_info_list[index]); display_info_list[index], update_data);
} }
} }
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
#ifndef UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_CONTROLLER_H_ #ifndef UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_CONTROLLER_H_
#define UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_CONTROLLER_H_ #define UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_CONTROLLER_H_
#include <map>
#include <memory>
#include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "ui/display/manager/display_manager_export.h" #include "ui/display/manager/display_manager_export.h"
#include "ui/gfx/geometry/size.h" #include "ui/gfx/geometry/size.h"
...@@ -20,6 +24,9 @@ namespace display { ...@@ -20,6 +24,9 @@ namespace display {
class DisplayConfigurator; class DisplayConfigurator;
class DisplayManager; class DisplayManager;
class ManagedDisplayInfo; class ManagedDisplayInfo;
class TouchTransformSetter;
struct TouchDeviceTransform;
namespace test { namespace test {
class TouchTransformControllerTest; class TouchTransformControllerTest;
...@@ -31,7 +38,8 @@ class TouchTransformControllerTest; ...@@ -31,7 +38,8 @@ class TouchTransformControllerTest;
class DISPLAY_MANAGER_EXPORT TouchTransformController { class DISPLAY_MANAGER_EXPORT TouchTransformController {
public: public:
TouchTransformController(DisplayConfigurator* display_configurator, TouchTransformController(DisplayConfigurator* display_configurator,
DisplayManager* display_manager); DisplayManager* display_manager,
std::unique_ptr<TouchTransformSetter> setter);
~TouchTransformController(); ~TouchTransformController();
// Updates the transform for touch input-devices and pushes the new transforms // Updates the transform for touch input-devices and pushes the new transforms
...@@ -45,6 +53,17 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController { ...@@ -45,6 +53,17 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
private: private:
friend class test::TouchTransformControllerTest; friend class test::TouchTransformControllerTest;
// Contains the data that is passed to TouchTransformSetter.
struct UpdateData {
UpdateData();
~UpdateData();
std::map<int32_t, double> device_to_scale;
std::vector<TouchDeviceTransform> touch_device_transforms;
};
void UpdateTouchTransforms(UpdateData* data) const;
// Returns a transform that will be used to change an event's location from // Returns a transform that will be used to change an event's location from
// the touchscreen's coordinate system into |display|'s coordinate system. // the touchscreen's coordinate system into |display|'s coordinate system.
// The transform is also responsible for properly scaling the display if the // The transform is also responsible for properly scaling the display if the
...@@ -66,20 +85,23 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController { ...@@ -66,20 +85,23 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
const ManagedDisplayInfo& touch_display, const ManagedDisplayInfo& touch_display,
const ui::TouchscreenDevice& touch_device) const; const ui::TouchscreenDevice& touch_device) const;
// For the provided |display| update the touch radius mapping. // For the provided |display| update the touch radius mapping in
void UpdateTouchRadius(const ManagedDisplayInfo& display) const; // |update_data|.
void UpdateTouchRadius(const ManagedDisplayInfo& display,
UpdateData* update_data) const;
// For a given |target_display| and |target_display_id| update the touch // For a given |target_display| and |target_display_id| update the touch
// transformation based on the touchscreen associated with |touch_display|. // transformation in |update_data| based on the touchscreen associated with
// |target_display_id| is the display id whose root window will receive the // |touch_display|. |target_display_id| is the display id to update the
// touch events. // transform for.
// |touch_display| is the physical display that has the touchscreen // |touch_display| is the physical display that has the touchscreen
// from which the events arrive. // from which the events arrive.
// |target_display| provides the dimensions to which the touch event will be // |target_display| provides the dimensions to which the touch event will be
// transformed. // transformed.
void UpdateTouchTransform(int64_t target_display_id, void UpdateTouchTransform(int64_t target_display_id,
const ManagedDisplayInfo& touch_display, const ManagedDisplayInfo& touch_display,
const ManagedDisplayInfo& target_display) const; const ManagedDisplayInfo& target_display,
UpdateData* update_data) const;
// Both |display_configurator_| and |display_manager_| are not owned and must // Both |display_configurator_| and |display_manager_| are not owned and must
// outlive TouchTransformController. // outlive TouchTransformController.
...@@ -88,6 +110,8 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController { ...@@ -88,6 +110,8 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
bool is_calibrating_ = false; bool is_calibrating_ = false;
std::unique_ptr<TouchTransformSetter> setter_;
DISALLOW_COPY_AND_ASSIGN(TouchTransformController); DISALLOW_COPY_AND_ASSIGN(TouchTransformController);
}; };
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/display/manager/chromeos/default_touch_transform_setter.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
#include "ui/display/screen_base.h" #include "ui/display/screen_base.h"
#include "ui/events/devices/device_data_manager.h" #include "ui/events/devices/device_data_manager.h"
...@@ -122,7 +123,8 @@ class TouchTransformControllerTest : public testing::Test { ...@@ -122,7 +123,8 @@ class TouchTransformControllerTest : public testing::Test {
Screen::SetScreenInstance(screen.get()); Screen::SetScreenInstance(screen.get());
display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen)); display_manager_ = base::MakeUnique<DisplayManager>(std::move(screen));
touch_transform_controller_ = base::MakeUnique<TouchTransformController>( touch_transform_controller_ = base::MakeUnique<TouchTransformController>(
nullptr, display_manager_.get()); nullptr, display_manager_.get(),
base::MakeUnique<DefaultTouchTransformSetter>());
} }
void TearDown() override { void TearDown() override {
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_SETTER_H_
#define UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_SETTER_H_
#include <map>
#include <vector>
#include "base/macros.h"
#include "ui/display/manager/display_manager_export.h"
namespace display {
struct TouchDeviceTransform;
// TouchTransformSetter is used by TouchTransformController to apply the actual
// settings.
class DISPLAY_MANAGER_EXPORT TouchTransformSetter {
public:
virtual ~TouchTransformSetter() {}
// |scales| maps from the touch device id to the touch radius scale and
// |transforms| contains the transform for each device and display pair.
virtual void ConfigureTouchDevices(
const std::map<int32_t, double>& scales,
const std::vector<TouchDeviceTransform>& transforms) = 0;
};
} // namespace display
#endif // UI_DISPLAY_MANAGER_CHROMEOS_TOUCH_TRANSFORM_SETTER_H_
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