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

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

Issue 2154523002: Move AccessibilityDelegate ownership to ash::WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@setmediadelegate
Patch Set: fix mash_unittests Created 4 years, 5 months 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 | « ash/common/wm_shell.cc ('k') | ash/mus/BUILD.gn » ('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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 558 }
559 559
560 //////////////////////////////////////////////////////////////////////////////// 560 ////////////////////////////////////////////////////////////////////////////////
561 // MagnificationControllerImpl: MagnificationController implementation 561 // MagnificationControllerImpl: MagnificationController implementation
562 562
563 void MagnificationControllerImpl::SetScale(float scale, bool animate) { 563 void MagnificationControllerImpl::SetScale(float scale, bool animate) {
564 if (!is_enabled_) 564 if (!is_enabled_)
565 return; 565 return;
566 566
567 ValidateScale(&scale); 567 ValidateScale(&scale);
568 WmShell::Get()->GetAccessibilityDelegate()->SaveScreenMagnifierScale(scale); 568 WmShell::Get()->accessibility_delegate()->SaveScreenMagnifierScale(scale);
569 RedrawKeepingMousePosition(scale, animate); 569 RedrawKeepingMousePosition(scale, animate);
570 } 570 }
571 571
572 void MagnificationControllerImpl::MoveWindow(int x, int y, bool animate) { 572 void MagnificationControllerImpl::MoveWindow(int x, int y, bool animate) {
573 if (!is_enabled_) 573 if (!is_enabled_)
574 return; 574 return;
575 575
576 Redraw(gfx::PointF(x, y), scale_, animate); 576 Redraw(gfx::PointF(x, y), scale_, animate);
577 } 577 }
578 578
(...skipping 12 matching lines...) Expand all
591 } 591 }
592 592
593 void MagnificationControllerImpl::SetEnabled(bool enabled) { 593 void MagnificationControllerImpl::SetEnabled(bool enabled) {
594 ui::InputMethod* input_method = GetInputMethod(root_window_); 594 ui::InputMethod* input_method = GetInputMethod(root_window_);
595 if (enabled) { 595 if (enabled) {
596 if (!is_enabled_ && input_method) 596 if (!is_enabled_ && input_method)
597 input_method->AddObserver(this); 597 input_method->AddObserver(this);
598 598
599 WmShell* wm_shell = WmShell::Get(); 599 WmShell* wm_shell = WmShell::Get();
600 float scale = 600 float scale =
601 wm_shell->GetAccessibilityDelegate()->GetSavedScreenMagnifierScale(); 601 wm_shell->accessibility_delegate()->GetSavedScreenMagnifierScale();
602 if (scale <= 0.0f) 602 if (scale <= 0.0f)
603 scale = kInitialMagnifiedScale; 603 scale = kInitialMagnifiedScale;
604 ValidateScale(&scale); 604 ValidateScale(&scale);
605 605
606 // Do nothing, if already enabled with same scale. 606 // Do nothing, if already enabled with same scale.
607 if (is_enabled_ && scale == scale_) 607 if (is_enabled_ && scale == scale_)
608 return; 608 return;
609 609
610 is_enabled_ = enabled; 610 is_enabled_ = enabled;
611 RedrawKeepingMousePosition(scale, true); 611 RedrawKeepingMousePosition(scale, true);
612 wm_shell->GetAccessibilityDelegate()->SaveScreenMagnifierScale(scale); 612 wm_shell->accessibility_delegate()->SaveScreenMagnifierScale(scale);
613 } else { 613 } else {
614 // Do nothing, if already disabled. 614 // Do nothing, if already disabled.
615 if (!is_enabled_) 615 if (!is_enabled_)
616 return; 616 return;
617 617
618 if (input_method) 618 if (input_method)
619 input_method->RemoveObserver(this); 619 input_method->RemoveObserver(this);
620 620
621 RedrawKeepingMousePosition(kNonMagnifiedScale, true); 621 RedrawKeepingMousePosition(kNonMagnifiedScale, true);
622 is_enabled_ = enabled; 622 is_enabled_ = enabled;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 847
848 //////////////////////////////////////////////////////////////////////////////// 848 ////////////////////////////////////////////////////////////////////////////////
849 // MagnificationController: 849 // MagnificationController:
850 850
851 // static 851 // static
852 MagnificationController* MagnificationController::CreateInstance() { 852 MagnificationController* MagnificationController::CreateInstance() {
853 return new MagnificationControllerImpl(); 853 return new MagnificationControllerImpl();
854 } 854 }
855 855
856 } // namespace ash 856 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.cc ('k') | ash/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698