Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: ash/magnifier/magnification_controller.h

Issue 10388141: Full-screen Magnifier: Support warping the cursor on the edge (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: review fix Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/event_filter.h"
11 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
12 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
13 15
14 namespace aura { 16 namespace aura {
15 class RootWindow; 17 class RootWindow;
16 } 18 }
17 19
18 namespace ash { 20 namespace ash {
19 namespace internal { 21 namespace internal {
20 22
21 class MagnificationController { 23 class MagnificationController {
22 public: 24 public:
23 MagnificationController(); 25 static MagnificationController* CreateInstance();
24
25 virtual ~MagnificationController() {}
26 26
27 // Sets the magnification ratio. 1.0f means no magnification. 27 // Sets the magnification ratio. 1.0f means no magnification.
28 void SetScale(float scale); 28 virtual void SetScale(float scale, bool animate) = 0;
29 // Returns the current magnification ratio. 29 // Returns the current magnification ratio.
30 float GetScale() const { return scale_; } 30 virtual float GetScale() const = 0;
31 31
32 // Set the top-left point of the magnification window. 32 // Set the top-left point of the magnification window.
33 void MoveWindow(int x, int y); 33 virtual void MoveWindow(int x, int y, bool animate) = 0;
34 void MoveWindow(const gfx::Point& point); 34 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0;
35 // Returns the current top-left point of the magnification window. 35 // Returns the current top-left point of the magnification window.
36 gfx::Point GetWindowPosition() const { return gfx::Point(x_, y_); } 36 virtual gfx::Point GetWindowPosition() const = 0;
37 37
38 // Ensures that the given point/rect is inside the magnification window. If 38 // Ensures that the given point/rect is inside the magnification window. If
39 // not, the controller moves the window to contain the given point/rect. 39 // not, the controller moves the window to contain the given point/rect.
40 void EnsureShowRect(const gfx::Rect& rect); 40 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0;
41 void EnsureShowPoint(const gfx::Point& point, bool animation); 41 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0;
sky 2012/06/20 03:54:16 Do we really need both EnsureRectIsVisible and Ens
yoshiki 2012/06/20 04:23:12 We are plan to use EnsureRectIsVisible() to zoom i
42 42
43 private: 43 protected:
44 aura::RootWindow* root_window_; 44 MagnificationController() {}
45
46 // Current scale, position of the magnification window.
47 float scale_;
48 int x_;
49 int y_;
50
51 // Returns the rect of the magnification window.
52 gfx::Rect GetWindowRect();
53 // Moves the magnification window to new scale and position. This method
54 // should be called internally just after the scale and/or the position are
55 // changed.
56 void RedrawScreen(bool animation);
57
58 DISALLOW_COPY_AND_ASSIGN(MagnificationController);
59 }; 45 };
60 46
61 } // namespace internal 47 } // namespace internal
62 } // namespace ash 48 } // namespace ash
63 49
64 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ 50 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698