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

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
« no previous file with comments | « ash/accelerators/accelerator_table.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
sky 2012/06/20 13:41:27 Document caller owns this.
yoshiki 2012/06/21 02:40:36 Done.
24 26
25 virtual ~MagnificationController() {} 27 virtual ~MagnificationController() {}
sky 2012/06/20 13:41:27 constructor/destructor should be before other meth
yoshiki 2012/06/21 02:40:36 Done.
26 28
27 // Sets the magnification ratio. 1.0f means no magnification. 29 // Sets the magnification ratio. 1.0f means no magnification.
28 void SetScale(float scale); 30 virtual void SetScale(float scale, bool animate) = 0;
29 // Returns the current magnification ratio. 31 // Returns the current magnification ratio.
30 float GetScale() const { return scale_; } 32 virtual float GetScale() const = 0;
31 33
32 // Set the top-left point of the magnification window. 34 // Set the top-left point of the magnification window.
33 void MoveWindow(int x, int y); 35 virtual void MoveWindow(int x, int y, bool animate) = 0;
34 void MoveWindow(const gfx::Point& point); 36 virtual void MoveWindow(const gfx::Point& point, bool animate) = 0;
35 // Returns the current top-left point of the magnification window. 37 // Returns the current top-left point of the magnification window.
36 gfx::Point GetWindowPosition() const { return gfx::Point(x_, y_); } 38 virtual gfx::Point GetWindowPosition() const = 0;
37 39
38 // Ensures that the given point/rect is inside the magnification window. If 40 // 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. 41 // not, the controller moves the window to contain the given point/rect.
40 void EnsureShowRect(const gfx::Rect& rect); 42 virtual void EnsureRectIsVisible(const gfx::Rect& rect, bool animate) = 0;
41 void EnsureShowPoint(const gfx::Point& point, bool animation); 43 virtual void EnsurePointIsVisible(const gfx::Point& point, bool animate) = 0;
42 44
43 private: 45 protected:
44 aura::RootWindow* root_window_; 46 MagnificationController() {}
sky 2012/06/20 13:41:27 I'm still confused. How does this compile with the
yoshiki 2012/06/21 02:40:36 You seem to be wrong. The destructor is not protec
sky 2012/06/21 16:28:06 Gah. I'm clearly wrong here. Sorry about that.
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 }; 47 };
60 48
61 } // namespace internal 49 } // namespace internal
62 } // namespace ash 50 } // namespace ash
63 51
64 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_ 52 #endif // ASH_MAGNIFIER_MAGNIFICATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_table.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698