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 #include "ash/magnifier/magnification_controller.h" | 5 #include "ash/magnifier/magnification_controller.h" |
6 | 6 |
7 #include "ash/ash_root_window_transformer.h" | 7 #include "ash/ash_root_window_transformer.h" |
8 #include "ash/display/display_controller.h" | 8 #include "ash/display/display_controller.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
12 #include "ash/system/tray/system_tray_delegate.h" | 12 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "base/synchronization/waitable_event.h" |
13 #include "ui/aura/client/cursor_client.h" | 14 #include "ui/aura/client/cursor_client.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
15 #include "ui/aura/root_window_transformer.h" | 16 #include "ui/aura/root_window_transformer.h" |
16 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
17 #include "ui/aura/window_property.h" | 18 #include "ui/aura/window_property.h" |
18 #include "ui/base/events/event.h" | 19 #include "ui/base/events/event.h" |
19 #include "ui/base/events/event_handler.h" | 20 #include "ui/base/events/event_handler.h" |
20 #include "ui/compositor/dip_util.h" | 21 #include "ui/compositor/dip_util.h" |
21 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
22 #include "ui/compositor/layer_animation_observer.h" | 23 #include "ui/compositor/layer_animation_observer.h" |
(...skipping 16 matching lines...) Expand all Loading... |
39 const float kScrollScaleChangeFactor = 0.05f; | 40 const float kScrollScaleChangeFactor = 0.05f; |
40 | 41 |
41 // Threadshold of panning. If the cursor moves to within pixels (in DIP) of | 42 // Threadshold of panning. If the cursor moves to within pixels (in DIP) of |
42 // |kPanningMergin| from the edge, the view-port moves. | 43 // |kPanningMergin| from the edge, the view-port moves. |
43 const int kPanningMergin = 100; | 44 const int kPanningMergin = 100; |
44 | 45 |
45 void MoveCursorTo(aura::RootWindow* root_window, | 46 void MoveCursorTo(aura::RootWindow* root_window, |
46 const gfx::Point root_location) { | 47 const gfx::Point root_location) { |
47 gfx::Point3F host_location_3f(root_location); | 48 gfx::Point3F host_location_3f(root_location); |
48 root_window->layer()->transform().TransformPoint(host_location_3f); | 49 root_window->layer()->transform().TransformPoint(host_location_3f); |
49 root_window->MoveCursorToHostLoation( | 50 root_window->MoveCursorToHostLocation( |
50 gfx::ToCeiledPoint(host_location_3f.AsPointF())); | 51 gfx::ToCeiledPoint(host_location_3f.AsPointF())); |
51 } | 52 } |
52 | 53 |
53 } // namespace | 54 } // namespace |
54 | 55 |
55 namespace ash { | 56 namespace ash { |
56 | 57 |
57 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
58 // MagnificationControllerImpl: | 59 // MagnificationControllerImpl: |
59 | 60 |
(...skipping 12 matching lines...) Expand all Loading... |
72 virtual float GetScale() const OVERRIDE { return scale_; } | 73 virtual float GetScale() const OVERRIDE { return scale_; } |
73 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; | 74 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; |
74 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; | 75 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; |
75 virtual gfx::Point GetWindowPosition() const OVERRIDE { | 76 virtual gfx::Point GetWindowPosition() const OVERRIDE { |
76 return gfx::ToFlooredPoint(origin_); | 77 return gfx::ToFlooredPoint(origin_); |
77 } | 78 } |
78 virtual void EnsureRectIsVisible(const gfx::Rect& rect, | 79 virtual void EnsureRectIsVisible(const gfx::Rect& rect, |
79 bool animate) OVERRIDE; | 80 bool animate) OVERRIDE; |
80 virtual void EnsurePointIsVisible(const gfx::Point& point, | 81 virtual void EnsurePointIsVisible(const gfx::Point& point, |
81 bool animate) OVERRIDE; | 82 bool animate) OVERRIDE; |
| 83 // For test |
| 84 virtual gfx::Point GetPointOfInterestForTesting() OVERRIDE { |
| 85 return point_of_interest_; |
| 86 } |
82 | 87 |
83 private: | 88 private: |
84 // ui::ImplicitAnimationObserver overrides: | 89 // ui::ImplicitAnimationObserver overrides: |
85 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 90 virtual void OnImplicitAnimationsCompleted() OVERRIDE; |
86 | 91 |
87 // aura::WindowObserver overrides: | 92 // aura::WindowObserver overrides: |
88 virtual void OnWindowDestroying(aura::Window* root_window) OVERRIDE; | 93 virtual void OnWindowDestroying(aura::Window* root_window) OVERRIDE; |
89 virtual void OnWindowBoundsChanged(aura::Window* window, | 94 virtual void OnWindowBoundsChanged(aura::Window* window, |
90 const gfx::Rect& old_bounds, | 95 const gfx::Rect& old_bounds, |
91 const gfx::Rect& new_bounds) OVERRIDE; | 96 const gfx::Rect& new_bounds) OVERRIDE; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 624 |
620 //////////////////////////////////////////////////////////////////////////////// | 625 //////////////////////////////////////////////////////////////////////////////// |
621 // MagnificationController: | 626 // MagnificationController: |
622 | 627 |
623 // static | 628 // static |
624 MagnificationController* MagnificationController::CreateInstance() { | 629 MagnificationController* MagnificationController::CreateInstance() { |
625 return new MagnificationControllerImpl(); | 630 return new MagnificationControllerImpl(); |
626 } | 631 } |
627 | 632 |
628 } // namespace ash | 633 } // namespace ash |
OLD | NEW |