| 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: |
| 23 enum ScrollDirection { |
| 24 SCROLL_NONE, |
| 25 SCROLL_LEFT, |
| 26 SCROLL_RIGHT, |
| 27 SCROLL_UP, |
| 28 SCROLL_DOWN |
| 29 }; |
| 30 |
| 22 virtual ~MagnificationController() {} | 31 virtual ~MagnificationController() {} |
| 23 | 32 |
| 24 // Creates a new MagnificationController. The caller takes ownership of the | 33 // Creates a new MagnificationController. The caller takes ownership of the |
| 25 // returned object. | 34 // returned object. |
| 26 static MagnificationController* CreateInstance(); | 35 static MagnificationController* CreateInstance(); |
| 27 | 36 |
| 28 // Enables (or disables if |enabled| is false) screen magnifier feature. | 37 // Enables (or disables if |enabled| is false) screen magnifier feature. |
| 29 virtual void SetEnabled(bool enabled) = 0; | 38 virtual void SetEnabled(bool enabled) = 0; |
| 30 | 39 |
| 31 // Returns if the screen magnifier is enabled or not. | 40 // Returns if the screen magnifier is enabled or not. |
| 32 virtual bool IsEnabled() const = 0; | 41 virtual bool IsEnabled() const = 0; |
| 33 | 42 |
| 34 // Sets the magnification ratio. 1.0f means no magnification. | 43 // Sets the magnification ratio. 1.0f means no magnification. |
| 35 virtual void SetScale(float scale, bool animate) = 0; | 44 virtual void SetScale(float scale, bool animate) = 0; |
| 36 // Returns the current magnification ratio. | 45 // Returns the current magnification ratio. |
| 37 virtual float GetScale() const = 0; | 46 virtual float GetScale() const = 0; |
| 38 | 47 |
| 39 // Set the top-left point of the magnification window. | 48 // Set the top-left point of the magnification window. |
| 40 virtual void MoveWindow(int x, int y, bool animate) = 0; | 49 virtual void MoveWindow(int x, int y, bool animate) = 0; |
| 41 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; | 50 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; |
| 42 // Returns the current top-left point of the magnification window. | 51 // Returns the current top-left point of the magnification window. |
| 43 virtual gfx::Point GetWindowPosition() const = 0; | 52 virtual gfx::Point GetWindowPosition() const = 0; |
| 44 | 53 |
| 45 // Ensures that the given point/rect is inside the magnification window. If | 54 virtual void SetScrollDirection(ScrollDirection direction) = 0; |
| 46 // not, the controller moves the window to contain the given point/rect. | |
| 47 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0; | |
| 48 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0; | |
| 49 | 55 |
| 50 // Returns |point_of_interest_| in MagnificationControllerImpl. This is | 56 // Returns |point_of_interest_| in MagnificationControllerImpl. This is |
| 51 // the internal variable to stores the last mouse cursor (or last touched) | 57 // the internal variable to stores the last mouse cursor (or last touched) |
| 52 // location. This method is only for test purpose. | 58 // location. This method is only for test purpose. |
| 53 virtual gfx::Point GetPointOfInterestForTesting() = 0; | 59 virtual gfx::Point GetPointOfInterestForTesting() = 0; |
| 54 | 60 |
| 55 protected: | 61 protected: |
| 56 MagnificationController() {} | 62 MagnificationController() {} |
| 63 |
| 64 private: |
| 65 DISALLOW_COPY_AND_ASSIGN(MagnificationController); |
| 57 }; | 66 }; |
| 58 | 67 |
| 59 } // namespace ash | 68 } // namespace ash |
| 60 | 69 |
| 61 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 70 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
| OLD | NEW |