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

Unified Diff: services/ui/ws/window_server.cc

Issue 2127383003: mus: Introduce high-contrast mode in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/ws/window_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_server.cc
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index 15108818cb839b6e1daa8717e7dae6adbd21a6e0..92aa4ae19d65c1d2b631ff3ec2132de0d80922db 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -282,6 +282,22 @@ ServerWindow* WindowServer::GetFocusedWindow() {
return nullptr;
}
+bool WindowServer::IsActiveUserInHighContrastMode() const {
+ return IsUserInHighContrastMode(user_id_tracker_.active_id());
+}
+
+void WindowServer::SetHighContrastMode(const UserId& user, bool enabled) {
+ if (IsUserInHighContrastMode(user) == enabled)
+ return;
+ high_contrast_mode_[user] = enabled;
+ if (user_id_tracker_.active_id() != user)
+ return;
+ for (Display* display : display_manager_->displays()) {
+ display->SchedulePaint(display->root_window(),
+ gfx::Rect(display->root_window()->bounds().size()));
+ }
+}
+
uint32_t WindowServer::GenerateWindowManagerChangeId(
WindowTree* source,
uint32_t client_change_id) {
@@ -515,6 +531,11 @@ void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
display_root->display()->UpdateNativeCursor(cursor_id);
}
+bool WindowServer::IsUserInHighContrastMode(const UserId& user) const {
+ const auto iter = high_contrast_mode_.find(user);
+ return (iter == high_contrast_mode_.end()) ? false : iter->second;
+}
+
ui::SurfacesState* WindowServer::GetSurfacesState() {
return surfaces_state_.get();
}
@@ -736,7 +757,15 @@ WindowManagerState* WindowServer::GetWindowManagerStateForUser(
}
void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) {}
+ const UserId& active_id) {
+ if (IsUserInHighContrastMode(previously_active_id) ==
+ IsUserInHighContrastMode(active_id))
+ return;
+ for (Display* display : display_manager_->displays()) {
+ display->SchedulePaint(display->root_window(),
+ gfx::Rect(display->root_window()->bounds().size()));
+ }
+}
void WindowServer::OnUserIdAdded(const UserId& id) {
activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
« no previous file with comments | « services/ui/ws/window_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698