Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: ash/magnifier/magnification_controller.cc

Issue 11280287: Magnifier: Prevent useless operation in enabling/disabling magnifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix test failure (MagnificationManagerTest.ChangeMagnifierType) Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/accessibility_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/accessibility_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698