| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/aura/event_filter.h" | 11 #include "ui/aura/event_filter.h" |
| 12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 namespace aura { | 15 namespace aura { |
| 16 class RootWindow; | 16 class RootWindow; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 namespace internal { | |
| 21 | 20 |
| 22 class MagnificationController { | 21 class MagnificationController { |
| 23 public: | 22 public: |
| 24 virtual ~MagnificationController() {} | 23 virtual ~MagnificationController() {} |
| 25 | 24 |
| 26 // Creates a new MagnificationController. The caller takes ownership of the | 25 // Creates a new MagnificationController. The caller takes ownership of the |
| 27 // returned object. | 26 // returned object. |
| 28 static MagnificationController* CreateInstance(); | 27 static MagnificationController* CreateInstance(); |
| 29 | 28 |
| 30 // Enables (or disables if |enabled| is false) screen magnifier feature. | 29 // Enables (or disables if |enabled| is false) screen magnifier feature. |
| 31 virtual void SetEnabled(bool enabled) = 0; | 30 virtual void SetEnabled(bool enabled) = 0; |
| 32 | 31 |
| 32 virtual bool IsEnabled() const = 0; |
| 33 |
| 33 // Sets the magnification ratio. 1.0f means no magnification. | 34 // Sets the magnification ratio. 1.0f means no magnification. |
| 34 virtual void SetScale(float scale, bool animate) = 0; | 35 virtual void SetScale(float scale, bool animate) = 0; |
| 35 // Returns the current magnification ratio. | 36 // Returns the current magnification ratio. |
| 36 virtual float GetScale() const = 0; | 37 virtual float GetScale() const = 0; |
| 37 | 38 |
| 38 // Set the top-left point of the magnification window. | 39 // Set the top-left point of the magnification window. |
| 39 virtual void MoveWindow(int x, int y, bool animate) = 0; | 40 virtual void MoveWindow(int x, int y, bool animate) = 0; |
| 40 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; | 41 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0; |
| 41 // Returns the current top-left point of the magnification window. | 42 // Returns the current top-left point of the magnification window. |
| 42 virtual gfx::Point GetWindowPosition() const = 0; | 43 virtual gfx::Point GetWindowPosition() const = 0; |
| 43 | 44 |
| 44 // Ensures that the given point/rect is inside the magnification window. If | 45 // Ensures that the given point/rect is inside the magnification window. If |
| 45 // not, the controller moves the window to contain the given point/rect. | 46 // not, the controller moves the window to contain the given point/rect. |
| 46 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0; | 47 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0; |
| 47 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0; | 48 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0; |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 MagnificationController() {} | 51 MagnificationController() {} |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace internal | |
| 54 } // namespace ash | 54 } // namespace ash |
| 55 | 55 |
| 56 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ | 56 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ |
| OLD | NEW |