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

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

Issue 2738133003: Promotes a handful of members from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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/default_wallpaper_delegate.cc ('k') | ash/mus/context_menu_mus.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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/accelerators/accelerator_controller.h" 10 #include "ash/common/accelerators/accelerator_controller.h"
11 #include "ash/common/accessibility_delegate.h" 11 #include "ash/common/accessibility_delegate.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 12 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/wm_shell.h"
14 #include "ash/display/root_window_transformers.h" 13 #include "ash/display/root_window_transformers.h"
15 #include "ash/host/ash_window_tree_host.h" 14 #include "ash/host/ash_window_tree_host.h"
16 #include "ash/host/root_window_transformer.h" 15 #include "ash/host/root_window_transformer.h"
17 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
18 #include "ash/shell.h" 17 #include "ash/shell.h"
19 #include "base/command_line.h" 18 #include "base/command_line.h"
20 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
21 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
22 #include "chromeos/chromeos_switches.h" 21 #include "chromeos/chromeos_switches.h"
23 #include "ui/aura/client/cursor_client.h" 22 #include "ui/aura/client/cursor_client.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 } 558 }
560 559
561 //////////////////////////////////////////////////////////////////////////////// 560 ////////////////////////////////////////////////////////////////////////////////
562 // MagnificationControllerImpl: MagnificationController implementation 561 // MagnificationControllerImpl: MagnificationController implementation
563 562
564 void MagnificationControllerImpl::SetScale(float scale, bool animate) { 563 void MagnificationControllerImpl::SetScale(float scale, bool animate) {
565 if (!is_enabled_) 564 if (!is_enabled_)
566 return; 565 return;
567 566
568 ValidateScale(&scale); 567 ValidateScale(&scale);
569 WmShell::Get()->accessibility_delegate()->SaveScreenMagnifierScale(scale); 568 Shell::GetInstance()->accessibility_delegate()->SaveScreenMagnifierScale(
569 scale);
570 RedrawKeepingMousePosition(scale, animate); 570 RedrawKeepingMousePosition(scale, animate);
571 } 571 }
572 572
573 void MagnificationControllerImpl::MoveWindow(int x, int y, bool animate) { 573 void MagnificationControllerImpl::MoveWindow(int x, int y, bool animate) {
574 if (!is_enabled_) 574 if (!is_enabled_)
575 return; 575 return;
576 576
577 Redraw(gfx::PointF(x, y), scale_, animate); 577 Redraw(gfx::PointF(x, y), scale_, animate);
578 } 578 }
579 579
(...skipping 10 matching lines...) Expand all
590 scroll_direction_ = direction; 590 scroll_direction_ = direction;
591 StartOrStopScrollIfNecessary(); 591 StartOrStopScrollIfNecessary();
592 } 592 }
593 593
594 void MagnificationControllerImpl::SetEnabled(bool enabled) { 594 void MagnificationControllerImpl::SetEnabled(bool enabled) {
595 ui::InputMethod* input_method = GetInputMethod(root_window_); 595 ui::InputMethod* input_method = GetInputMethod(root_window_);
596 if (enabled) { 596 if (enabled) {
597 if (!is_enabled_ && input_method) 597 if (!is_enabled_ && input_method)
598 input_method->AddObserver(this); 598 input_method->AddObserver(this);
599 599
600 WmShell* wm_shell = WmShell::Get(); 600 Shell* shell = Shell::GetInstance();
601 float scale = 601 float scale =
602 wm_shell->accessibility_delegate()->GetSavedScreenMagnifierScale(); 602 shell->accessibility_delegate()->GetSavedScreenMagnifierScale();
603 if (scale <= 0.0f) 603 if (scale <= 0.0f)
604 scale = kInitialMagnifiedScale; 604 scale = kInitialMagnifiedScale;
605 ValidateScale(&scale); 605 ValidateScale(&scale);
606 606
607 // Do nothing, if already enabled with same scale. 607 // Do nothing, if already enabled with same scale.
608 if (is_enabled_ && scale == scale_) 608 if (is_enabled_ && scale == scale_)
609 return; 609 return;
610 610
611 is_enabled_ = enabled; 611 is_enabled_ = enabled;
612 RedrawKeepingMousePosition(scale, true); 612 RedrawKeepingMousePosition(scale, true);
613 wm_shell->accessibility_delegate()->SaveScreenMagnifierScale(scale); 613 shell->accessibility_delegate()->SaveScreenMagnifierScale(scale);
614 } else { 614 } else {
615 // Do nothing, if already disabled. 615 // Do nothing, if already disabled.
616 if (!is_enabled_) 616 if (!is_enabled_)
617 return; 617 return;
618 618
619 if (input_method) 619 if (input_method)
620 input_method->RemoveObserver(this); 620 input_method->RemoveObserver(this);
621 621
622 RedrawKeepingMousePosition(kNonMagnifiedScale, true); 622 RedrawKeepingMousePosition(kNonMagnifiedScale, true);
623 is_enabled_ = enabled; 623 is_enabled_ = enabled;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 886
887 //////////////////////////////////////////////////////////////////////////////// 887 ////////////////////////////////////////////////////////////////////////////////
888 // MagnificationController: 888 // MagnificationController:
889 889
890 // static 890 // static
891 MagnificationController* MagnificationController::CreateInstance() { 891 MagnificationController* MagnificationController::CreateInstance() {
892 return new MagnificationControllerImpl(); 892 return new MagnificationControllerImpl();
893 } 893 }
894 894
895 } // namespace ash 895 } // namespace ash
OLDNEW
« no previous file with comments | « ash/default_wallpaper_delegate.cc ('k') | ash/mus/context_menu_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698