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

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

Issue 10915140: Add the partial screen magnifier to Chrome OS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove pure virtual interface Created 8 years, 2 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
(Empty)
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_PARTIAL_MAGNIFICATION_CONTROLLER_H_
6 #define ASH_MAGNIFIER_PARTIAL_MAGNIFICATION_CONTROLLER_H_
7
8 #include "ui/aura/event_filter.h"
9 #include "ui/aura/window_observer.h"
10 #include "ui/gfx/point3.h"
11 #include "ui/views/widget/widget_observer.h"
12
13 namespace aura {
14 class RootWindow;
15 }
16
17 namespace ash {
18 namespace internal {
19
20 const float kDefaultPartialMagnifiedScale = 1.5f;
21 const float kNonPartialMagnifiedScale = 1.0f;
22
23 // Controls the partial screen magnifier, which is a small area of the screen
24 // which is zoomed in. The zoomed area follows the mouse cursor when enabled.
25 class PartialMagnificationController
26 : public aura::EventFilter,
sky 2012/10/16 16:29:22 nit: indent 4.
Zachary Kuznia 2012/11/12 08:43:46 Done.
27 public aura::WindowObserver,
28 public views::WidgetObserver {
29 public:
30 PartialMagnificationController();
31 virtual ~PartialMagnificationController();
32
33 // Enables (or disables if |enabled| is false) partial screen magnifier
34 // feature.
35 void SetEnabled(bool enabled);
36
37 bool IsEnabled() const;
38
39 // Sets the magnification ratio. 1.0f means no magnification.
40 void SetScale(float scale);
41
42 // Returns the current magnification ratio.
43 float GetScale() const;
44
45 private:
46 void OnMouseMove(const gfx::Point& location_in_root);
47
48 // Switch PartialMagnified RootWindow to |new_root_window|. This does
49 // following:
50 // - Remove the magnifier from the current root window.
51 // - Create a magnifier in the new root_window |new_root_window|.
52 // - Switch the target window from current window to |new_root_window|.
53 void SwitchTargetRootWindow(aura::RootWindow* new_root_window);
54
55 // Returns the root window that contains the mouse cursor.
56 aura::RootWindow* GetCurrentRootWindow();
57
58 // Return true if the magnification scale > kMinPartialMagnifiedScaleThreshold
59 bool IsPartialMagnified() const;
60
61 // Create the magnifier window.
62 void CreateMagnifierWindow();
63
64 // Cleans up the window if needed.
65 void CloseMagnifierWindow();
66
67 // aura::EventFilter overrides:
68 virtual bool PreHandleKeyEvent(aura::Window* target,
69 ui::KeyEvent* event) OVERRIDE;
70 virtual bool PreHandleMouseEvent(aura::Window* target,
71 ui::MouseEvent* event) OVERRIDE;
72 virtual ui::TouchStatus PreHandleTouchEvent(
73 aura::Window* target,
74 ui::TouchEvent* event) OVERRIDE;
75 virtual ui::EventResult PreHandleGestureEvent(
76 aura::Window* target,
77 ui::GestureEvent* event) OVERRIDE;
78
79 // Overridden from WindowObserver:
80 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
81
82 // Overridden from WidgetObserver:
83 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE;
84
85 // True if the magnified window is in motion of zooming or un-zooming effect.
86 // Otherwise, false.
87 bool is_on_zooming_;
88
89 bool is_enabled_;
90
91 // Current scale, origin (left-top) position of the magnification window.
92 float scale_;
93 gfx::Point origin_;
94
95 views::Widget* zoom_widget_;
96
97 DISALLOW_COPY_AND_ASSIGN(PartialMagnificationController);
98 };
99
100 } // namespace internal
101 } // namespace ash
102
103 #endif // ASH_MAGNIFIER_PARTIAL_MAGNIFICATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698