| 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 "components/mus/ws/window_server.h" | 5 #include "components/mus/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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" | 13 #include "components/mus/public/cpp/surfaces/surfaces_type_converters.h" |
| 14 #include "components/mus/ws/display.h" | 14 #include "components/mus/ws/display.h" |
| 15 #include "components/mus/ws/display_binding.h" | 15 #include "components/mus/ws/display_binding.h" |
| 16 #include "components/mus/ws/display_manager.h" | 16 #include "components/mus/ws/display_manager.h" |
| 17 #include "components/mus/ws/operation.h" | 17 #include "components/mus/ws/operation.h" |
| 18 #include "components/mus/ws/server_window.h" | 18 #include "components/mus/ws/server_window.h" |
| 19 #include "components/mus/ws/user_activity_monitor.h" |
| 19 #include "components/mus/ws/window_coordinate_conversions.h" | 20 #include "components/mus/ws/window_coordinate_conversions.h" |
| 20 #include "components/mus/ws/window_manager_access_policy.h" | 21 #include "components/mus/ws/window_manager_access_policy.h" |
| 21 #include "components/mus/ws/window_manager_display_root.h" | 22 #include "components/mus/ws/window_manager_display_root.h" |
| 22 #include "components/mus/ws/window_manager_state.h" | 23 #include "components/mus/ws/window_manager_state.h" |
| 23 #include "components/mus/ws/window_manager_window_tree_factory.h" | 24 #include "components/mus/ws/window_manager_window_tree_factory.h" |
| 24 #include "components/mus/ws/window_server_delegate.h" | 25 #include "components/mus/ws/window_server_delegate.h" |
| 25 #include "components/mus/ws/window_tree.h" | 26 #include "components/mus/ws/window_tree.h" |
| 26 #include "components/mus/ws/window_tree_binding.h" | 27 #include "components/mus/ws/window_tree_binding.h" |
| 27 #include "services/shell/public/cpp/connection.h" | 28 #include "services/shell/public/cpp/connection.h" |
| 28 #include "ui/gfx/geometry/size_conversions.h" | 29 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { | 223 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { |
| 223 if (display_manager_->has_active_or_pending_displays()) | 224 if (display_manager_->has_active_or_pending_displays()) |
| 224 return; | 225 return; |
| 225 | 226 |
| 226 // We've been supplied a WindowManagerFactory and no displays have been | 227 // We've been supplied a WindowManagerFactory and no displays have been |
| 227 // created yet. Treat this as a signal to create a Display. | 228 // created yet. Treat this as a signal to create a Display. |
| 228 // TODO(sky): we need a better way to determine this, most likely a switch. | 229 // TODO(sky): we need a better way to determine this, most likely a switch. |
| 229 delegate_->CreateDefaultDisplays(); | 230 delegate_->CreateDefaultDisplays(); |
| 230 } | 231 } |
| 231 | 232 |
| 233 UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser( |
| 234 const UserId& user_id) { |
| 235 return GetWindowManagerStateForUser(user_id)->user_activity_monitor(); |
| 236 } |
| 237 |
| 232 bool WindowServer::SetFocusedWindow(ServerWindow* window) { | 238 bool WindowServer::SetFocusedWindow(ServerWindow* window) { |
| 233 // TODO(sky): this should fail if there is modal dialog active and |window| | 239 // TODO(sky): this should fail if there is modal dialog active and |window| |
| 234 // is outside that. | 240 // is outside that. |
| 235 ServerWindow* currently_focused = GetFocusedWindow(); | 241 ServerWindow* currently_focused = GetFocusedWindow(); |
| 236 Display* focused_display = | 242 Display* focused_display = |
| 237 currently_focused | 243 currently_focused |
| 238 ? display_manager_->GetDisplayContaining(currently_focused) | 244 ? display_manager_->GetDisplayContaining(currently_focused) |
| 239 : nullptr; | 245 : nullptr; |
| 240 if (!window) | 246 if (!window) |
| 241 return focused_display ? focused_display->SetFocusedWindow(nullptr) : true; | 247 return focused_display ? focused_display->SetFocusedWindow(nullptr) : true; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 681 } |
| 676 | 682 |
| 677 WindowManagerState* WindowServer::GetWindowManagerStateForUser( | 683 WindowManagerState* WindowServer::GetWindowManagerStateForUser( |
| 678 const UserId& user_id) { | 684 const UserId& user_id) { |
| 679 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( | 685 return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser( |
| 680 user_id); | 686 user_id); |
| 681 } | 687 } |
| 682 | 688 |
| 683 } // namespace ws | 689 } // namespace ws |
| 684 } // namespace mus | 690 } // namespace mus |
| OLD | NEW |