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:
ash
@@ -12,13 +12,25 @@ namespace ash {
|
|||||||
|
|
||||||
HighContrastController::HighContrastController()
|
HighContrastController::HighContrastController()
|
||||||
: enabled_(false) {
|
: enabled_(false) {
|
||||||
root_window_ = ash::Shell::GetPrimaryRootWindow();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighContrastController::SetEnabled(bool enabled) {
|
void HighContrastController::SetEnabled(bool enabled) {
|
||||||
enabled_ = 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
|
} // namespace ash
|
||||||
|
@@ -20,11 +20,17 @@ class ASH_EXPORT HighContrastController {
|
|||||||
|
|
||||||
~HighContrastController() {}
|
~HighContrastController() {}
|
||||||
|
|
||||||
|
// Set high contrast mode and update all available displays.
|
||||||
void SetEnabled(bool enabled);
|
void SetEnabled(bool enabled);
|
||||||
|
|
||||||
private:
|
// Update high contrast mode on the just added display.
|
||||||
aura::RootWindow* root_window_;
|
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_;
|
bool enabled_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(HighContrastController);
|
DISALLOW_COPY_AND_ASSIGN(HighContrastController);
|
||||||
|
@@ -666,6 +666,7 @@ void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
|
|||||||
InitRootWindowController(controller);
|
InitRootWindowController(controller);
|
||||||
controller->root_window_layout()->OnWindowResized();
|
controller->root_window_layout()->OnWindowResized();
|
||||||
desktop_background_controller_->OnRootWindowAdded(root);
|
desktop_background_controller_->OnRootWindowAdded(root);
|
||||||
|
high_contrast_controller_->OnRootWindowAdded(root);
|
||||||
root->ShowRootWindow();
|
root->ShowRootWindow();
|
||||||
// Activate new root for testing.
|
// Activate new root for testing.
|
||||||
active_root_window_ = root;
|
active_root_window_ = root;
|
||||||
|
Reference in New Issue
Block a user