Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ash / touch / touch_transformer_controller.h
blob8512186603d757b0bb8d096596e469130f0f9077
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 ash {
14 // TouchTransformerController listens to display configuration change
15 // and updates the touch transformation for touch displays.
16 class ASH_EXPORT TouchTransformerController
17 : public DisplayController::Observer {
18 public:
19 TouchTransformerController();
20 virtual ~TouchTransformerController();
22 // Updates the TouchTransformer for touch device and pushes the new
23 // TouchTransformer into device manager.
24 void UpdateTouchTransformer() const;
26 // DisplayController::Observer:
27 virtual void OnDisplaysInitialized() OVERRIDE;
28 virtual void OnDisplayConfigurationChanged() OVERRIDE;
30 private:
31 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
32 TouchTransformerMirrorModeLetterboxing);
33 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
34 TouchTransformerMirrorModePillarboxing);
35 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
36 TouchTransformerExtendedMode);
37 FRIEND_TEST_ALL_PREFIXES(TouchTransformerControllerTest,
38 TouchRadiusScale);
40 bool ShouldComputeMirrorModeTouchTransformer(
41 const DisplayInfo& touch_display) const ;
43 gfx::Transform GetMirrorModeTouchTransformer(
44 const DisplayInfo& touch_display) const;
46 gfx::Transform GetExtendedModeTouchTransformer(
47 const DisplayInfo& touch_display, const gfx::Size& fb_size) const;
49 double GetTouchResolutionScale(const DisplayInfo& touch_display) const;
51 // For unittests only.
52 bool force_compute_mirror_mode_touch_transformer_;
54 DISALLOW_COPY_AND_ASSIGN(TouchTransformerController);
57 } // namespace ash
59 #endif // ASH_TOUCH_TOUCH_TRANSFORMER_CONTROLLER_H_