| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 199 } |
| 200 | 200 |
| 201 ServerWindow* WindowServer::GetWindow(const WindowId& id) { | 201 ServerWindow* WindowServer::GetWindow(const WindowId& id) { |
| 202 // kInvalidClientId is used for Display and WindowManager nodes. | 202 // kInvalidClientId is used for Display and WindowManager nodes. |
| 203 if (id.client_id == kInvalidClientId) { | 203 if (id.client_id == kInvalidClientId) { |
| 204 for (Display* display : display_manager_->displays()) { | 204 for (Display* display : display_manager_->displays()) { |
| 205 ServerWindow* window = display->GetRootWithId(id); | 205 ServerWindow* window = display->GetRootWithId(id); |
| 206 if (window) | 206 if (window) |
| 207 return window; | 207 return window; |
| 208 } | 208 } |
| 209 // WindowManagerDisplayRoots are destroyed by the client and not held by |
| 210 // the Display. |
| 211 for (auto& pair : tree_map_) { |
| 212 if (pair.second->window_manager_state()) { |
| 213 ServerWindow* window = |
| 214 pair.second->window_manager_state()->GetOrphanedRootWithId(id); |
| 215 if (window) |
| 216 return window; |
| 217 } |
| 218 } |
| 209 } | 219 } |
| 210 WindowTree* tree = GetTreeWithId(id.client_id); | 220 WindowTree* tree = GetTreeWithId(id.client_id); |
| 211 return tree ? tree->GetWindow(id) : nullptr; | 221 return tree ? tree->GetWindow(id) : nullptr; |
| 212 } | 222 } |
| 213 | 223 |
| 214 void WindowServer::SchedulePaint(ServerWindow* window, | 224 void WindowServer::SchedulePaint(ServerWindow* window, |
| 215 const gfx::Rect& bounds) { | 225 const gfx::Rect& bounds) { |
| 216 Display* display = display_manager_->GetDisplayContaining(window); | 226 Display* display = display_manager_->GetDisplayContaining(window); |
| 217 if (display) | 227 if (display) |
| 218 display->SchedulePaint(window, bounds); | 228 display->SchedulePaint(window, bounds); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 void WindowServer::OnUserIdAdded(const UserId& id) { | 830 void WindowServer::OnUserIdAdded(const UserId& id) { |
| 821 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 831 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 822 } | 832 } |
| 823 | 833 |
| 824 void WindowServer::OnUserIdRemoved(const UserId& id) { | 834 void WindowServer::OnUserIdRemoved(const UserId& id) { |
| 825 activity_monitor_map_.erase(id); | 835 activity_monitor_map_.erase(id); |
| 826 } | 836 } |
| 827 | 837 |
| 828 } // namespace ws | 838 } // namespace ws |
| 829 } // namespace ui | 839 } // namespace ui |
| OLD | NEW |