• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
6 #define ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
7 
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/gfx/point.h"
13 #include "ui/gfx/rect.h"
14 
15 namespace aura {
16 class RootWindow;
17 }
18 
19 namespace ash {
20 
21 class ASH_EXPORT MagnificationController {
22  public:
23   enum ScrollDirection {
24     SCROLL_NONE,
25     SCROLL_LEFT,
26     SCROLL_RIGHT,
27     SCROLL_UP,
28     SCROLL_DOWN
29   };
30 
~MagnificationController()31   virtual ~MagnificationController() {}
32 
33   // Creates a new MagnificationController. The caller takes ownership of the
34   // returned object.
35   static MagnificationController* CreateInstance();
36 
37   // Enables (or disables if |enabled| is false) screen magnifier feature.
38   virtual void SetEnabled(bool enabled) = 0;
39 
40   // Returns if the screen magnifier is enabled or not.
41   virtual bool IsEnabled() const = 0;
42 
43   // Sets the magnification ratio. 1.0f means no magnification.
44   virtual void SetScale(float scale, bool animate) = 0;
45   // Returns the current magnification ratio.
46   virtual float GetScale() const = 0;
47 
48   // Set the top-left point of the magnification window.
49   virtual void MoveWindow(int x, int y, bool animate) = 0;
50   virtual void MoveWindow(const gfx::Point& point, bool animate) = 0;
51   // Returns the current top-left point of the magnification window.
52   virtual gfx::Point GetWindowPosition() const = 0;
53 
54   virtual void SetScrollDirection(ScrollDirection direction) = 0;
55 
56   // Returns |point_of_interest_| in MagnificationControllerImpl. This is
57   // the internal variable to stores the last mouse cursor (or last touched)
58   // location. This method is only for test purpose.
59   virtual gfx::Point GetPointOfInterestForTesting() = 0;
60 
61  protected:
MagnificationController()62   MagnificationController() {}
63 
64  private:
65   DISALLOW_COPY_AND_ASSIGN(MagnificationController);
66 };
67 
68 }  // namespace ash
69 
70 #endif  // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
71