OLD | NEW |
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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 CHECK(current_operation_); | 591 CHECK(current_operation_); |
592 current_operation_ = nullptr; | 592 current_operation_ = nullptr; |
593 } | 593 } |
594 | 594 |
595 void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) { | 595 void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) { |
596 WindowManagerDisplayRoot* display_root = | 596 WindowManagerDisplayRoot* display_root = |
597 display_manager_->GetWindowManagerDisplayRoot(window); | 597 display_manager_->GetWindowManagerDisplayRoot(window); |
598 if (display_root) { | 598 if (display_root) { |
599 EventDispatcher* event_dispatcher = | 599 EventDispatcher* event_dispatcher = |
600 display_root->window_manager_state()->event_dispatcher(); | 600 display_root->window_manager_state()->event_dispatcher(); |
601 event_dispatcher->UpdateCursorProviderByLastKnownLocation(); | 601 event_dispatcher->UpdateCursorProviderByLastKnownLocation(base::Bind( |
602 display_root->display()->UpdateNativeCursor( | 602 &WindowServer::OnCursorUpdated, base::Unretained(this), display_root)); |
603 event_dispatcher->GetCurrentMouseCursor()); | |
604 } | 603 } |
605 } | 604 } |
606 | 605 |
607 void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) { | 606 void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) { |
608 WindowManagerDisplayRoot* display_root = | 607 WindowManagerDisplayRoot* display_root = |
609 display_manager_->GetWindowManagerDisplayRoot(window); | 608 display_manager_->GetWindowManagerDisplayRoot(window); |
610 if (!display_root) | 609 if (!display_root) |
611 return; | 610 return; |
612 | 611 |
613 EventDispatcher* event_dispatcher = | 612 EventDispatcher* event_dispatcher = |
614 display_root->window_manager_state()->event_dispatcher(); | 613 display_root->window_manager_state()->event_dispatcher(); |
615 if (window != event_dispatcher->GetWindowForMouseCursor()) | 614 if (window != event_dispatcher->GetWindowForMouseCursor()) |
616 return; | 615 return; |
617 | 616 |
618 event_dispatcher->UpdateNonClientAreaForCurrentWindow(); | 617 event_dispatcher->UpdateNonClientAreaForCurrentWindow(base::Bind( |
| 618 &WindowServer::OnCursorUpdated, base::Unretained(this), display_root)); |
| 619 } |
| 620 |
| 621 void WindowServer::OnCursorUpdated(WindowManagerDisplayRoot* display_root) { |
619 display_root->display()->UpdateNativeCursor( | 622 display_root->display()->UpdateNativeCursor( |
620 event_dispatcher->GetCurrentMouseCursor()); | 623 display_root->window_manager_state() |
| 624 ->event_dispatcher() |
| 625 ->GetCurrentMouseCursor()); |
621 } | 626 } |
622 | 627 |
623 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const { | 628 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const { |
624 const auto iter = high_contrast_mode_.find(user); | 629 const auto iter = high_contrast_mode_.find(user); |
625 return (iter == high_contrast_mode_.end()) ? false : iter->second; | 630 return (iter == high_contrast_mode_.end()) ? false : iter->second; |
626 } | 631 } |
627 | 632 |
628 void WindowServer::HandleTemporaryReferenceForNewSurface( | 633 void WindowServer::HandleTemporaryReferenceForNewSurface( |
629 const cc::SurfaceId& surface_id, | 634 const cc::SurfaceId& surface_id, |
630 ServerWindow* window) { | 635 ServerWindow* window) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 void WindowServer::OnUserIdAdded(const UserId& id) { | 876 void WindowServer::OnUserIdAdded(const UserId& id) { |
872 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 877 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
873 } | 878 } |
874 | 879 |
875 void WindowServer::OnUserIdRemoved(const UserId& id) { | 880 void WindowServer::OnUserIdRemoved(const UserId& id) { |
876 activity_monitor_map_.erase(id); | 881 activity_monitor_map_.erase(id); |
877 } | 882 } |
878 | 883 |
879 } // namespace ws | 884 } // namespace ws |
880 } // namespace ui | 885 } // namespace ui |
OLD | NEW |