| 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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accessibility_delegate.h" | 8 #include "ash/accessibility_delegate.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/root_window_transformers.h" | 10 #include "ash/display/root_window_transformers.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 class MagnificationControllerImpl : virtual public MagnificationController, | 63 class MagnificationControllerImpl : virtual public MagnificationController, |
| 64 public ui::EventHandler, | 64 public ui::EventHandler, |
| 65 public ui::ImplicitAnimationObserver, | 65 public ui::ImplicitAnimationObserver, |
| 66 public aura::WindowObserver { | 66 public aura::WindowObserver { |
| 67 public: | 67 public: |
| 68 MagnificationControllerImpl(); | 68 MagnificationControllerImpl(); |
| 69 virtual ~MagnificationControllerImpl(); | 69 virtual ~MagnificationControllerImpl(); |
| 70 | 70 |
| 71 // MagnificationController overrides: | 71 // MagnificationController overrides: |
| 72 virtual void SetEnabled(bool enabled) OVERRIDE; | 72 virtual void SetEnabled(bool enabled) override; |
| 73 virtual bool IsEnabled() const OVERRIDE; | 73 virtual bool IsEnabled() const override; |
| 74 virtual void SetScale(float scale, bool animate) OVERRIDE; | 74 virtual void SetScale(float scale, bool animate) override; |
| 75 virtual float GetScale() const OVERRIDE { return scale_; } | 75 virtual float GetScale() const override { return scale_; } |
| 76 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; | 76 virtual void MoveWindow(int x, int y, bool animate) override; |
| 77 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; | 77 virtual void MoveWindow(const gfx::Point& point, bool animate) override; |
| 78 virtual gfx::Point GetWindowPosition() const OVERRIDE { | 78 virtual gfx::Point GetWindowPosition() const override { |
| 79 return gfx::ToFlooredPoint(origin_); | 79 return gfx::ToFlooredPoint(origin_); |
| 80 } | 80 } |
| 81 virtual void SetScrollDirection(ScrollDirection direction) OVERRIDE; | 81 virtual void SetScrollDirection(ScrollDirection direction) override; |
| 82 | 82 |
| 83 // For test | 83 // For test |
| 84 virtual gfx::Point GetPointOfInterestForTesting() OVERRIDE { | 84 virtual gfx::Point GetPointOfInterestForTesting() override { |
| 85 return point_of_interest_; | 85 return point_of_interest_; |
| 86 } | 86 } |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 // ui::ImplicitAnimationObserver overrides: | 89 // ui::ImplicitAnimationObserver overrides: |
| 90 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | 90 virtual void OnImplicitAnimationsCompleted() override; |
| 91 | 91 |
| 92 // aura::WindowObserver overrides: | 92 // aura::WindowObserver overrides: |
| 93 virtual void OnWindowDestroying(aura::Window* root_window) OVERRIDE; | 93 virtual void OnWindowDestroying(aura::Window* root_window) override; |
| 94 virtual void OnWindowBoundsChanged(aura::Window* window, | 94 virtual void OnWindowBoundsChanged(aura::Window* window, |
| 95 const gfx::Rect& old_bounds, | 95 const gfx::Rect& old_bounds, |
| 96 const gfx::Rect& new_bounds) OVERRIDE; | 96 const gfx::Rect& new_bounds) override; |
| 97 | 97 |
| 98 // Redraws the magnification window with the given origin position and the | 98 // Redraws the magnification window with the given origin position and the |
| 99 // given scale. Returns true if the window is changed; otherwise, false. | 99 // given scale. Returns true if the window is changed; otherwise, false. |
| 100 // These methods should be called internally just after the scale and/or | 100 // These methods should be called internally just after the scale and/or |
| 101 // the position are changed to redraw the window. | 101 // the position are changed to redraw the window. |
| 102 bool Redraw(const gfx::PointF& position, float scale, bool animate); | 102 bool Redraw(const gfx::PointF& position, float scale, bool animate); |
| 103 bool RedrawDIP(const gfx::PointF& position, float scale, bool animate); | 103 bool RedrawDIP(const gfx::PointF& position, float scale, bool animate); |
| 104 | 104 |
| 105 // 1) If the screen is scrolling (i.e. animating) and should scroll further, | 105 // 1) If the screen is scrolling (i.e. animating) and should scroll further, |
| 106 // it does nothing. | 106 // it does nothing. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 133 | 133 |
| 134 // Returns the rect of the magnification window. | 134 // Returns the rect of the magnification window. |
| 135 gfx::RectF GetWindowRectDIP(float scale) const; | 135 gfx::RectF GetWindowRectDIP(float scale) const; |
| 136 // Returns the size of the root window. | 136 // Returns the size of the root window. |
| 137 gfx::Size GetHostSizeDIP() const; | 137 gfx::Size GetHostSizeDIP() const; |
| 138 | 138 |
| 139 // Correct the givin scale value if nessesary. | 139 // Correct the givin scale value if nessesary. |
| 140 void ValidateScale(float* scale); | 140 void ValidateScale(float* scale); |
| 141 | 141 |
| 142 // ui::EventHandler overrides: | 142 // ui::EventHandler overrides: |
| 143 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 143 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
| 144 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 144 virtual void OnScrollEvent(ui::ScrollEvent* event) override; |
| 145 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 145 virtual void OnTouchEvent(ui::TouchEvent* event) override; |
| 146 | 146 |
| 147 // Target root window. This must not be NULL. | 147 // Target root window. This must not be NULL. |
| 148 aura::Window* root_window_; | 148 aura::Window* root_window_; |
| 149 | 149 |
| 150 // True if the magnified window is currently animating a change. Otherwise, | 150 // True if the magnified window is currently animating a change. Otherwise, |
| 151 // false. | 151 // false. |
| 152 bool is_on_animation_; | 152 bool is_on_animation_; |
| 153 | 153 |
| 154 bool is_enabled_; | 154 bool is_enabled_; |
| 155 | 155 |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 599 |
| 600 //////////////////////////////////////////////////////////////////////////////// | 600 //////////////////////////////////////////////////////////////////////////////// |
| 601 // MagnificationController: | 601 // MagnificationController: |
| 602 | 602 |
| 603 // static | 603 // static |
| 604 MagnificationController* MagnificationController::CreateInstance() { | 604 MagnificationController* MagnificationController::CreateInstance() { |
| 605 return new MagnificationControllerImpl(); | 605 return new MagnificationControllerImpl(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace ash | 608 } // namespace ash |
| OLD | NEW |