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 "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 void MagnificationControllerImpl::EnsurePointIsVisible( | 465 void MagnificationControllerImpl::EnsurePointIsVisible( |
466 const gfx::Point& point, | 466 const gfx::Point& point, |
467 bool animate) { | 467 bool animate) { |
468 if (!is_enabled_) | 468 if (!is_enabled_) |
469 return; | 469 return; |
470 | 470 |
471 EnsurePointIsVisibleWithScale(point, scale_, animate); | 471 EnsurePointIsVisibleWithScale(point, scale_, animate); |
472 } | 472 } |
473 | 473 |
474 void MagnificationControllerImpl::SetEnabled(bool enabled) { | 474 void MagnificationControllerImpl::SetEnabled(bool enabled) { |
| 475 if (enabled == is_enabled_) |
| 476 return; |
| 477 |
475 if (enabled) { | 478 if (enabled) { |
476 float scale = | 479 float scale = |
477 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); | 480 ash::Shell::GetInstance()->delegate()->GetSavedScreenMagnifierScale(); |
478 if (scale <= 0.0f) | 481 if (scale <= 0.0f) |
479 scale = GetDefaultZoomScale(); | 482 scale = GetDefaultZoomScale(); |
480 ValidateScale(&scale); | 483 ValidateScale(&scale); |
481 RedrawKeepingMousePosition(scale, true); | 484 RedrawKeepingMousePosition(scale, true); |
482 is_enabled_ = enabled; | 485 is_enabled_ = enabled; |
483 } else { | 486 } else { |
484 RedrawKeepingMousePosition(kNonMagnifiedScale, true); | 487 RedrawKeepingMousePosition(kNonMagnifiedScale, true); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 536 |
534 //////////////////////////////////////////////////////////////////////////////// | 537 //////////////////////////////////////////////////////////////////////////////// |
535 // MagnificationController: | 538 // MagnificationController: |
536 | 539 |
537 // static | 540 // static |
538 MagnificationController* MagnificationController::CreateInstance() { | 541 MagnificationController* MagnificationController::CreateInstance() { |
539 return new MagnificationControllerImpl(); | 542 return new MagnificationControllerImpl(); |
540 } | 543 } |
541 | 544 |
542 } // namespace ash | 545 } // namespace ash |
OLD | NEW |