From 0e3e7cbbea37a6303ddae4f7524968be622dca70 Mon Sep 17 00:00:00 2001 From: "flackr@chromium.org" Date: Sat, 12 Apr 2014 05:18:25 +0000 Subject: Block keyboard and mouse input when maximize mode is activated by accelerometer. BUG=353409 TEST=MaximizeModeControllerTest.BlocksKeyboardAndMouse Review URL: https://codereview.chromium.org/230613004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263481 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/high_contrast/high_contrast_controller.cc | 13 +++++++++---- ash/high_contrast/high_contrast_controller.h | 11 +++++------ 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'ash/high_contrast') diff --git a/ash/high_contrast/high_contrast_controller.cc b/ash/high_contrast/high_contrast_controller.cc index 03618c56..418dd71 100644 --- a/ash/high_contrast/high_contrast_controller.cc +++ b/ash/high_contrast/high_contrast_controller.cc @@ -12,6 +12,11 @@ namespace ash { HighContrastController::HighContrastController() : enabled_(false) { + Shell::GetInstance()->AddShellObserver(this); +} + +HighContrastController::~HighContrastController() { + Shell::GetInstance()->RemoveShellObserver(this); } void HighContrastController::SetEnabled(bool enabled) { @@ -25,12 +30,12 @@ void HighContrastController::SetEnabled(bool enabled) { } } -void HighContrastController::OnRootWindowAdded(aura::Window* root_window) { - UpdateDisplay(root_window); -} - void HighContrastController::UpdateDisplay(aura::Window* root_window) { root_window->layer()->SetLayerInverted(enabled_); } +void HighContrastController::OnRootWindowAdded(aura::Window* root_window) { + UpdateDisplay(root_window); +} + } // namespace ash diff --git a/ash/high_contrast/high_contrast_controller.h b/ash/high_contrast/high_contrast_controller.h index 49aca61..10d0b7d 100644 --- a/ash/high_contrast/high_contrast_controller.h +++ b/ash/high_contrast/high_contrast_controller.h @@ -6,26 +6,25 @@ #define ASH_HIGH_CONTRAST_HIGH_CONTRAST_CONTROLLER_H_ #include "ash/ash_export.h" +#include "ash/shell_observer.h" #include "base/basictypes.h" namespace aura { -class RootWindow; class Window; } namespace ash { -class ASH_EXPORT HighContrastController { +class ASH_EXPORT HighContrastController : public ShellObserver { public: HighContrastController(); - - ~HighContrastController() {} + virtual ~HighContrastController(); // Set high contrast mode and update all available displays. void SetEnabled(bool enabled); - // Update high contrast mode on the just added display. - void OnRootWindowAdded(aura::Window* root_window); + // ShellObserver: + virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE; private: // Update high contrast mode on the passed display. -- cgit v1.1