0

High contrast mode support for multiple displays.

All displays are now updated when high contrast mode is changed in settings. Moreover, if a new display is attached, then high contrast setting is applied on it.

BUG=150972


Review URL: https://chromiumcodereview.appspot.com/10962008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159188 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
mtomasz@chromium.org
2012-09-28 03:08:09 +00:00
parent 25ea00d315
commit 6b37addd54
3 changed files with 23 additions and 4 deletions

@ -12,13 +12,25 @@ namespace ash {
HighContrastController::HighContrastController()
: enabled_(false) {
root_window_ = ash::Shell::GetPrimaryRootWindow();
}
void HighContrastController::SetEnabled(bool enabled) {
enabled_ = enabled;
root_window_->layer()->SetLayerInverted(enabled_);
// Update all active displays.
Shell::RootWindowList root_window_list = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator it = root_window_list.begin();
it != root_window_list.end(); it++) {
UpdateDisplay(*it);
}
}
void HighContrastController::OnRootWindowAdded(aura::RootWindow* root_window) {
UpdateDisplay(root_window);
}
void HighContrastController::UpdateDisplay(aura::RootWindow* root_window) {
root_window->layer()->SetLayerInverted(enabled_);
}
} // namespace ash

@ -20,11 +20,17 @@ class ASH_EXPORT HighContrastController {
~HighContrastController() {}
// Set high contrast mode and update all available displays.
void SetEnabled(bool enabled);
private:
aura::RootWindow* root_window_;
// Update high contrast mode on the just added display.
void OnRootWindowAdded(aura::RootWindow* root_window);
private:
// Update high contrast mode on the passed display.
void UpdateDisplay(aura::RootWindow* root_window);
// Indicates if the high contrast mode is enabled or disabled.
bool enabled_;
DISALLOW_COPY_AND_ASSIGN(HighContrastController);

@ -666,6 +666,7 @@ void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
InitRootWindowController(controller);
controller->root_window_layout()->OnWindowResized();
desktop_background_controller_->OnRootWindowAdded(root);
high_contrast_controller_->OnRootWindowAdded(root);
root->ShowRootWindow();
// Activate new root for testing.
active_root_window_ = root;