Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: ui/display/manager/chromeos/touch_transform_controller.h

Issue 2887413004: chromeos: moves setting of touch state to a separate class (Closed)
Patch Set: feedback Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/display/manager/chromeos/touch_transform_controller.h
diff --git a/ui/display/manager/chromeos/touch_transform_controller.h b/ui/display/manager/chromeos/touch_transform_controller.h
index b911a311feceb45e95405369a7ed8319f2a3e96e..69239bc5301dd7e74058b4948f8d71e40d38e3f0 100644
--- a/ui/display/manager/chromeos/touch_transform_controller.h
+++ b/ui/display/manager/chromeos/touch_transform_controller.h
@@ -5,6 +5,10 @@
#ifndef 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 "ui/display/manager/display_manager_export.h"
#include "ui/gfx/geometry/size.h"
@@ -20,6 +24,9 @@ namespace display {
class DisplayConfigurator;
class DisplayManager;
class ManagedDisplayInfo;
+class TouchTransformSetter;
+
+struct TouchDeviceTransform;
namespace test {
class TouchTransformControllerTest;
@@ -31,7 +38,8 @@ class TouchTransformControllerTest;
class DISPLAY_MANAGER_EXPORT TouchTransformController {
public:
TouchTransformController(DisplayConfigurator* display_configurator,
- DisplayManager* display_manager);
+ DisplayManager* display_manager,
+ std::unique_ptr<TouchTransformSetter> setter);
~TouchTransformController();
// Updates the transform for touch input-devices and pushes the new transforms
@@ -45,6 +53,17 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
private:
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
// the touchscreen's coordinate system into |display|'s coordinate system.
// The transform is also responsible for properly scaling the display if the
@@ -66,20 +85,23 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
const ManagedDisplayInfo& touch_display,
const ui::TouchscreenDevice& touch_device) const;
- // For the provided |display| update the touch radius mapping.
- void UpdateTouchRadius(const ManagedDisplayInfo& display) const;
+ // For the provided |display| update the touch radius mapping in
+ // |update_data|.
+ void UpdateTouchRadius(const ManagedDisplayInfo& display,
+ UpdateData* update_data) const;
// For a given |target_display| and |target_display_id| update the touch
- // transformation based on the touchscreen associated with |touch_display|.
- // |target_display_id| is the display id whose root window will receive the
- // touch events.
+ // transformation in |update_data| based on the touchscreen associated with
+ // |touch_display|. |target_display_id| is the display id to update the
+ // transform for.
// |touch_display| is the physical display that has the touchscreen
// from which the events arrive.
// |target_display| provides the dimensions to which the touch event will be
// transformed.
void UpdateTouchTransform(int64_t target_display_id,
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
// outlive TouchTransformController.
@@ -88,6 +110,8 @@ class DISPLAY_MANAGER_EXPORT TouchTransformController {
bool is_calibrating_ = false;
+ std::unique_ptr<TouchTransformSetter> setter_;
+
DISALLOW_COPY_AND_ASSIGN(TouchTransformController);
};
« no previous file with comments | « ui/display/manager/chromeos/touch_device_transform.cc ('k') | ui/display/manager/chromeos/touch_transform_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698