blob: 31a0dbbcc6c39d05385299791e1e6c628e8e8c19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/shell.h"
#include "ui/aura/root_window.h"
#include "ui/compositor/layer.h"
namespace ash {
HighContrastController::HighContrastController()
: enabled_(false) {
}
void HighContrastController::SetEnabled(bool enabled) {
enabled_ = 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
|