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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « services/ui/ws/window_server.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/window_server.h" 5 #include "services/ui/ws/window_server.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 ServerWindow* WindowServer::GetFocusedWindow() { 276 ServerWindow* WindowServer::GetFocusedWindow() {
277 for (Display* display : display_manager_->displays()) { 277 for (Display* display : display_manager_->displays()) {
278 ServerWindow* focused_window = display->GetFocusedWindow(); 278 ServerWindow* focused_window = display->GetFocusedWindow();
279 if (focused_window) 279 if (focused_window)
280 return focused_window; 280 return focused_window;
281 } 281 }
282 return nullptr; 282 return nullptr;
283 } 283 }
284 284
285 bool WindowServer::IsActiveUserInHighContrastMode() const {
286 return IsUserInHighContrastMode(user_id_tracker_.active_id());
287 }
288
289 void WindowServer::SetHighContrastMode(const UserId& user, bool enabled) {
290 if (IsUserInHighContrastMode(user) == enabled)
291 return;
292 high_contrast_mode_[user] = enabled;
293 if (user_id_tracker_.active_id() != user)
294 return;
295 for (Display* display : display_manager_->displays()) {
296 display->SchedulePaint(display->root_window(),
297 gfx::Rect(display->root_window()->bounds().size()));
298 }
299 }
300
285 uint32_t WindowServer::GenerateWindowManagerChangeId( 301 uint32_t WindowServer::GenerateWindowManagerChangeId(
286 WindowTree* source, 302 WindowTree* source,
287 uint32_t client_change_id) { 303 uint32_t client_change_id) {
288 const uint32_t wm_change_id = next_wm_change_id_++; 304 const uint32_t wm_change_id = next_wm_change_id_++;
289 in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id}; 305 in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id};
290 return wm_change_id; 306 return wm_change_id;
291 } 307 }
292 308
293 void WindowServer::WindowManagerChangeCompleted( 309 void WindowServer::WindowManagerChangeCompleted(
294 uint32_t window_manager_change_id, 310 uint32_t window_manager_change_id,
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 display_root->window_manager_state()->event_dispatcher(); 524 display_root->window_manager_state()->event_dispatcher();
509 if (window != event_dispatcher->mouse_cursor_source_window()) 525 if (window != event_dispatcher->mouse_cursor_source_window())
510 return; 526 return;
511 527
512 event_dispatcher->UpdateNonClientAreaForCurrentWindow(); 528 event_dispatcher->UpdateNonClientAreaForCurrentWindow();
513 int32_t cursor_id = 0; 529 int32_t cursor_id = 0;
514 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id)) 530 if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
515 display_root->display()->UpdateNativeCursor(cursor_id); 531 display_root->display()->UpdateNativeCursor(cursor_id);
516 } 532 }
517 533
534 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const {
535 const auto iter = high_contrast_mode_.find(user);
536 return (iter == high_contrast_mode_.end()) ? false : iter->second;
537 }
538
518 ui::SurfacesState* WindowServer::GetSurfacesState() { 539 ui::SurfacesState* WindowServer::GetSurfacesState() {
519 return surfaces_state_.get(); 540 return surfaces_state_.get();
520 } 541 }
521 542
522 void WindowServer::OnScheduleWindowPaint(ServerWindow* window) { 543 void WindowServer::OnScheduleWindowPaint(ServerWindow* window) {
523 if (in_destructor_) 544 if (in_destructor_)
524 return; 545 return;
525 546
526 SchedulePaint(window, gfx::Rect(window->bounds().size())); 547 SchedulePaint(window, gfx::Rect(window->bounds().size()));
527 if (!window_paint_callback_.is_null()) 548 if (!window_paint_callback_.is_null())
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 return window_manager_state->got_frame_decoration_values(); 750 return window_manager_state->got_frame_decoration_values();
730 } 751 }
731 752
732 WindowManagerState* WindowServer::GetWindowManagerStateForUser( 753 WindowManagerState* WindowServer::GetWindowManagerStateForUser(
733 const UserId& user_id) { 754 const UserId& user_id) {
734 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( 755 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
735 user_id); 756 user_id);
736 } 757 }
737 758
738 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, 759 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
739 const UserId& active_id) {} 760 const UserId& active_id) {
761 if (IsUserInHighContrastMode(previously_active_id) ==
762 IsUserInHighContrastMode(active_id))
763 return;
764 for (Display* display : display_manager_->displays()) {
765 display->SchedulePaint(display->root_window(),
766 gfx::Rect(display->root_window()->bounds().size()));
767 }
768 }
740 769
741 void WindowServer::OnUserIdAdded(const UserId& id) { 770 void WindowServer::OnUserIdAdded(const UserId& id) {
742 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); 771 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
743 } 772 }
744 773
745 void WindowServer::OnUserIdRemoved(const UserId& id) { 774 void WindowServer::OnUserIdRemoved(const UserId& id) {
746 activity_monitor_map_.erase(id); 775 activity_monitor_map_.erase(id);
747 } 776 }
748 777
749 } // namespace ws 778 } // namespace ws
750 } // namespace ui 779 } // namespace ui
OLDNEW
« 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