| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ui/aura/event_filter.h" | 9 #include "ui/aura/event_filter.h" |
| 10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class MagnificationControllerImpl : virtual public MagnificationController, | 40 class MagnificationControllerImpl : virtual public MagnificationController, |
| 41 public aura::EventFilter, | 41 public aura::EventFilter, |
| 42 public ui::ImplicitAnimationObserver { | 42 public ui::ImplicitAnimationObserver { |
| 43 public: | 43 public: |
| 44 MagnificationControllerImpl(); | 44 MagnificationControllerImpl(); |
| 45 virtual ~MagnificationControllerImpl(); | 45 virtual ~MagnificationControllerImpl(); |
| 46 | 46 |
| 47 // MagnificationController overrides: | 47 // MagnificationController overrides: |
| 48 virtual void SetEnabled(bool enabled) OVERRIDE; | 48 virtual void SetEnabled(bool enabled) OVERRIDE; |
| 49 virtual bool IsEnabled() OVERRIDE { return is_enabled_; } |
| 49 virtual void SetScale(float scale, bool animate) OVERRIDE; | 50 virtual void SetScale(float scale, bool animate) OVERRIDE; |
| 50 virtual float GetScale() const OVERRIDE { return scale_; } | 51 virtual float GetScale() const OVERRIDE { return scale_; } |
| 51 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; | 52 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; |
| 52 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; | 53 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; |
| 53 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } | 54 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } |
| 54 virtual void EnsureRectIsVisible(const gfx::Rect& rect, | 55 virtual void EnsureRectIsVisible(const gfx::Rect& rect, |
| 55 bool animate) OVERRIDE; | 56 bool animate) OVERRIDE; |
| 56 virtual void EnsurePointIsVisible(const gfx::Point& point, | 57 virtual void EnsurePointIsVisible(const gfx::Point& point, |
| 57 bool animate) OVERRIDE; | 58 bool animate) OVERRIDE; |
| 58 | 59 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (!is_enabled_) | 411 if (!is_enabled_) |
| 411 return; | 412 return; |
| 412 | 413 |
| 413 EnsurePointIsVisibleWithScale(point, scale_, animate); | 414 EnsurePointIsVisibleWithScale(point, scale_, animate); |
| 414 } | 415 } |
| 415 | 416 |
| 416 void MagnificationControllerImpl::SetEnabled(bool enabled) { | 417 void MagnificationControllerImpl::SetEnabled(bool enabled) { |
| 417 if (enabled) { | 418 if (enabled) { |
| 418 float scale = | 419 float scale = |
| 419 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); | 420 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); |
| 421 if (scale <= 0.0f) |
| 422 scale = kInitialMagnifiedScale; |
| 420 ValidateScale(&scale); | 423 ValidateScale(&scale); |
| 421 RedrawKeepingMousePosition(scale, true); | 424 RedrawKeepingMousePosition(scale, true); |
| 422 is_enabled_ = enabled; | 425 is_enabled_ = enabled; |
| 423 } else { | 426 } else { |
| 424 RedrawKeepingMousePosition(kNonMagnifiedScale, true); | 427 RedrawKeepingMousePosition(kNonMagnifiedScale, true); |
| 425 is_enabled_ = enabled; | 428 is_enabled_ = enabled; |
| 426 } | 429 } |
| 427 } | 430 } |
| 428 | 431 |
| 429 //////////////////////////////////////////////////////////////////////////////// | 432 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 //////////////////////////////////////////////////////////////////////////////// | 479 //////////////////////////////////////////////////////////////////////////////// |
| 477 // MagnificationController: | 480 // MagnificationController: |
| 478 | 481 |
| 479 // static | 482 // static |
| 480 MagnificationController* MagnificationController::CreateInstance() { | 483 MagnificationController* MagnificationController::CreateInstance() { |
| 481 return new MagnificationControllerImpl(); | 484 return new MagnificationControllerImpl(); |
| 482 } | 485 } |
| 483 | 486 |
| 484 } // namespace internal | 487 } // namespace internal |
| 485 } // namespace ash | 488 } // namespace ash |
| OLD | NEW |