Remove adapter method on HistoryBackend delegating to AndroidProviderBackend
[chromium-blink-merge.git] / ash / touch / touch_transformer_controller.h
blob1ca7acf918b08bb9a91ed426e71cf68d56e1d4d1
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
6 #define ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ash/display/display_controller.h"
10 #include "ui/gfx/transform.h"
12 namespace ui {
13 struct TouchscreenDevice;
14 } // namespace ui
16 namespace ash {
18 // TouchTransformerController listens to display configuration change
19 // and updates the touch transformation for touch displays.
20 class ASH_EXPORT TouchTransformerController
21 : public DisplayController::Observer {
22 public:
23 TouchTransformerController();
24 ~TouchTransformerController() override;
26 // Updates the TouchTransformer for touch device and pushes the new
27 // TouchTransformer into device manager.
28 void UpdateTouchTransformer() const;
30 // DisplayController::Observer:
31 void OnDisplaysInitialized() override;
32 void OnDisplayConfigurationChanged() override;
34 private:
35 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
36 MirrorModeLetterboxing);
37 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
38 MirrorModePillarboxing);
39 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, SoftwareMirrorMode);
40 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, ExtendedMode);
41 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest, TouchRadiusScale);
43 // Returns a transform that will be used to change an event's location from
44 // the touchscreen's coordinate system into |display|'s coordinate system.
45 // The transform is also responsible for properly scaling the display if the
46 // display supports panel fitting.
48 // On X11 events are reported in framebuffer coordinate space, so the
49 // |framebuffer_size| is used for scaling.
50 // On Ozone events are reported in the touchscreen's resolution, so
51 // |touch_display| is used to determine the size and scale the event.
52 gfx::Transform GetTouchTransform(const DisplayInfo& display,
53 const DisplayInfo& touch_display,
54 const ui::TouchscreenDevice& touchscreen,
55 const gfx::Size& framebuffer_size) const;
57 // Returns the scaling factor for the touch radius such that it scales the
58 // radius from |touch_device|'s coordinate system to the |touch_display|'s
59 // coordinate system.
60 double GetTouchResolutionScale(
61 const DisplayInfo& touch_display,
62 const ui::TouchscreenDevice& touch_device) const;
64 DISALLOW_COPY_AND_ASSIGN(TouchTransformerController);
67 } // namespace ash
69 #endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_