OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | |
8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class RootWindow; | 16 class RootWindow; |
16 } | 17 } |
17 | 18 |
18 namespace ash { | 19 namespace ash { |
19 | 20 |
20 class MagnificationController { | 21 class ASH_EXPORT MagnificationController { |
21 public: | 22 public: |
22 virtual ~MagnificationController() {} | 23 virtual ~MagnificationController() {} |
23 | 24 |
24 // Creates a new MagnificationController. The caller takes ownership of the | 25 // Creates a new MagnificationController. The caller takes ownership of the |
25 // returned object. | 26 // returned object. |
26 static MagnificationController* CreateInstance(); | 27 static MagnificationController* CreateInstance(); |
27 | 28 |
29 static bool IsMagnifierAcceleratorsEnabled(); | |
30 static void SetMagnifierAcceleratorsEnabled(bool enabled); | |
31 | |
28 // Enables (or disables if |enabled| is false) screen magnifier feature. | 32 // Enables (or disables if |enabled| is false) screen magnifier feature. |
29 virtual void SetEnabled(bool enabled) = 0; | 33 virtual void SetEnabled(bool enabled) = 0; |
30 | 34 |
31 // Returns if the screen magnifier is enabled or not. | 35 // Returns if the screen magnifier is enabled or not. |
32 virtual bool IsEnabled() const = 0; | 36 virtual bool IsEnabled() const = 0; |
33 | 37 |
34 // Sets the magnification ratio. 1.0f means no magnification. | 38 // Sets the magnification ratio. 1.0f means no magnification. |
35 virtual void SetScale(float scale, bool animate) = 0; | 39 virtual void SetScale(float scale, bool animate) = 0; |
36 // Returns the current magnification ratio. | 40 // Returns the current magnification ratio. |
37 virtual float GetScale() const = 0; | 41 virtual float GetScale() const = 0; |
38 | 42 |
39 // Set the top-left point of the magnification window. | 43 // Set the top-left point of the magnification window. |
40 virtual void MoveWindow(int x, int y, bool animate) = 0; | 44 virtual void MoveWindow(int x, int y, bool animate) = 0; |
41 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; | 45 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; |
42 // Returns the current top-left point of the magnification window. | 46 // Returns the current top-left point of the magnification window. |
43 virtual gfx::Point GetWindowPosition() const = 0; | 47 virtual gfx::Point GetWindowPosition() const = 0; |
44 | 48 |
45 // Ensures that the given point/rect is inside the magnification window. If | 49 enum ScrollDirection { |
46 // not, the controller moves the window to contain the given point/rect. | 50 SCROLL_NONE, |
47 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0; | 51 SCROLL_LEFT, |
48 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0; | 52 SCROLL_RIGHT, |
oshima
2014/02/06 22:57:31
They were dead code.
| |
53 SCROLL_UP, | |
54 SCROLL_DOWN | |
55 }; | |
56 | |
57 virtual void SetScrollDirection(ScrollDirection direction) = 0; | |
49 | 58 |
50 // Returns |point_of_interest_| in MagnificationControllerImpl. This is | 59 // Returns |point_of_interest_| in MagnificationControllerImpl. This is |
51 // the internal variable to stores the last mouse cursor (or last touched) | 60 // the internal variable to stores the last mouse cursor (or last touched) |
52 // location. This method is only for test purpose. | 61 // location. This method is only for test purpose. |
53 virtual gfx::Point GetPointOfInterestForTesting() = 0; | 62 virtual gfx::Point GetPointOfInterestForTesting() = 0; |
54 | 63 |
64 // A scoped object to enable and disable the magnifier accelerator for test. | |
65 class ScopedMagnifierAcceleratorsEnablerForTest { | |
66 public: | |
67 ScopedMagnifierAcceleratorsEnablerForTest() { | |
68 MagnificationController::SetMagnifierAcceleratorsEnabled(true); | |
69 } | |
70 ~ScopedMagnifierAcceleratorsEnablerForTest() { | |
71 MagnificationController::SetMagnifierAcceleratorsEnabled(false); | |
72 } | |
73 | |
74 private: | |
75 DISALLOW_COPY_AND_ASSIGN(ScopedMagnifierAcceleratorsEnablerForTest); | |
76 }; | |
55 protected: | 77 protected: |
78 | |
56 MagnificationController() {} | 79 MagnificationController() {} |
80 | |
81 private: | |
82 DISALLOW_COPY_AND_ASSIGN(MagnificationController); | |
57 }; | 83 }; |
58 | 84 |
59 } // namespace ash | 85 } // namespace ash |
60 | 86 |
61 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 87 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
OLD | NEW |