| 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/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
| 10 #include "ui/aura/event_filter.h" | 10 #include "ui/aura/event_filter.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class MagnificationControllerImpl : virtual public MagnificationController, | 41 class MagnificationControllerImpl : virtual public MagnificationController, |
| 42 public aura::EventFilter, | 42 public aura::EventFilter, |
| 43 public ui::ImplicitAnimationObserver { | 43 public ui::ImplicitAnimationObserver { |
| 44 public: | 44 public: |
| 45 MagnificationControllerImpl(); | 45 MagnificationControllerImpl(); |
| 46 virtual ~MagnificationControllerImpl(); | 46 virtual ~MagnificationControllerImpl(); |
| 47 | 47 |
| 48 // MagnificationController overrides: | 48 // MagnificationController overrides: |
| 49 virtual void SetEnabled(bool enabled) OVERRIDE; | 49 virtual void SetEnabled(bool enabled) OVERRIDE; |
| 50 virtual bool IsEnabled() const OVERRIDE; |
| 50 virtual void SetScale(float scale, bool animate) OVERRIDE; | 51 virtual void SetScale(float scale, bool animate) OVERRIDE; |
| 51 virtual float GetScale() const OVERRIDE { return scale_; } | 52 virtual float GetScale() const OVERRIDE { return scale_; } |
| 52 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; | 53 virtual void MoveWindow(int x, int y, bool animate) OVERRIDE; |
| 53 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; | 54 virtual void MoveWindow(const gfx::Point& point, bool animate) OVERRIDE; |
| 54 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } | 55 virtual gfx::Point GetWindowPosition() const OVERRIDE { return origin_; } |
| 55 virtual void EnsureRectIsVisible(const gfx::Rect& rect, | 56 virtual void EnsureRectIsVisible(const gfx::Rect& rect, |
| 56 bool animate) OVERRIDE; | 57 bool animate) OVERRIDE; |
| 57 virtual void EnsurePointIsVisible(const gfx::Point& point, | 58 virtual void EnsurePointIsVisible(const gfx::Point& point, |
| 58 bool animate) OVERRIDE; | 59 bool animate) OVERRIDE; |
| 59 | 60 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); | 427 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); |
| 427 ValidateScale(&scale); | 428 ValidateScale(&scale); |
| 428 RedrawKeepingMousePosition(scale, true); | 429 RedrawKeepingMousePosition(scale, true); |
| 429 is_enabled_ = enabled; | 430 is_enabled_ = enabled; |
| 430 } else { | 431 } else { |
| 431 RedrawKeepingMousePosition(kNonMagnifiedScale, true); | 432 RedrawKeepingMousePosition(kNonMagnifiedScale, true); |
| 432 is_enabled_ = enabled; | 433 is_enabled_ = enabled; |
| 433 } | 434 } |
| 434 } | 435 } |
| 435 | 436 |
| 437 bool MagnificationControllerImpl::IsEnabled() const { |
| 438 return is_enabled_; |
| 439 } |
| 440 |
| 436 //////////////////////////////////////////////////////////////////////////////// | 441 //////////////////////////////////////////////////////////////////////////////// |
| 437 // MagnificationControllerImpl: aura::EventFilter implementation | 442 // MagnificationControllerImpl: aura::EventFilter implementation |
| 438 | 443 |
| 439 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, | 444 bool MagnificationControllerImpl::PreHandleKeyEvent(aura::Window* target, |
| 440 ui::KeyEvent* event) { | 445 ui::KeyEvent* event) { |
| 441 return false; | 446 return false; |
| 442 } | 447 } |
| 443 | 448 |
| 444 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, | 449 bool MagnificationControllerImpl::PreHandleMouseEvent(aura::Window* target, |
| 445 ui::MouseEvent* event) { | 450 ui::MouseEvent* event) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 //////////////////////////////////////////////////////////////////////////////// | 488 //////////////////////////////////////////////////////////////////////////////// |
| 484 // MagnificationController: | 489 // MagnificationController: |
| 485 | 490 |
| 486 // static | 491 // static |
| 487 MagnificationController* MagnificationController::CreateInstance() { | 492 MagnificationController* MagnificationController::CreateInstance() { |
| 488 return new MagnificationControllerImpl(); | 493 return new MagnificationControllerImpl(); |
| 489 } | 494 } |
| 490 | 495 |
| 491 } // namespace internal | 496 } // namespace internal |
| 492 } // namespace ash | 497 } // namespace ash |
| OLD | NEW |