| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/display_manager.h" | 5 #include "services/ui/ws/display_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "services/ui/ws/cursor_location_manager.h" |
| 11 #include "services/ui/ws/display.h" | 12 #include "services/ui/ws/display.h" |
| 12 #include "services/ui/ws/display_binding.h" | 13 #include "services/ui/ws/display_binding.h" |
| 13 #include "services/ui/ws/event_dispatcher.h" | 14 #include "services/ui/ws/event_dispatcher.h" |
| 14 #include "services/ui/ws/platform_display_init_params.h" | 15 #include "services/ui/ws/platform_display_init_params.h" |
| 15 #include "services/ui/ws/server_window.h" | 16 #include "services/ui/ws/server_window.h" |
| 16 #include "services/ui/ws/user_display_manager.h" | 17 #include "services/ui/ws/user_display_manager.h" |
| 17 #include "services/ui/ws/user_display_manager_delegate.h" | 18 #include "services/ui/ws/user_display_manager_delegate.h" |
| 18 #include "services/ui/ws/user_id_tracker.h" | 19 #include "services/ui/ws/user_id_tracker.h" |
| 19 #include "services/ui/ws/window_manager_state.h" | 20 #include "services/ui/ws/window_manager_state.h" |
| 20 #include "services/ui/ws/window_manager_window_tree_factory.h" | 21 #include "services/ui/ws/window_manager_window_tree_factory.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 | 43 |
| 43 UserDisplayManager* DisplayManager::GetUserDisplayManager( | 44 UserDisplayManager* DisplayManager::GetUserDisplayManager( |
| 44 const UserId& user_id) { | 45 const UserId& user_id) { |
| 45 if (!user_display_managers_.count(user_id)) { | 46 if (!user_display_managers_.count(user_id)) { |
| 46 user_display_managers_[user_id] = | 47 user_display_managers_[user_id] = |
| 47 base::MakeUnique<UserDisplayManager>(this, window_server_, user_id); | 48 base::MakeUnique<UserDisplayManager>(this, window_server_, user_id); |
| 48 } | 49 } |
| 49 return user_display_managers_[user_id].get(); | 50 return user_display_managers_[user_id].get(); |
| 50 } | 51 } |
| 51 | 52 |
| 53 CursorLocationManager* DisplayManager::GetCursorLocationManager( |
| 54 const UserId& user_id) { |
| 55 if (!cursor_location_managers_.count(user_id)) { |
| 56 cursor_location_managers_[user_id] = |
| 57 base::MakeUnique<CursorLocationManager>(); |
| 58 } |
| 59 return cursor_location_managers_[user_id].get(); |
| 60 } |
| 61 |
| 52 void DisplayManager::AddDisplay(Display* display) { | 62 void DisplayManager::AddDisplay(Display* display) { |
| 53 DCHECK_EQ(0u, pending_displays_.count(display)); | 63 DCHECK_EQ(0u, pending_displays_.count(display)); |
| 54 pending_displays_.insert(display); | 64 pending_displays_.insert(display); |
| 55 } | 65 } |
| 56 | 66 |
| 57 void DisplayManager::DestroyDisplay(Display* display) { | 67 void DisplayManager::DestroyDisplay(Display* display) { |
| 58 if (pending_displays_.count(display)) { | 68 if (pending_displays_.count(display)) { |
| 59 pending_displays_.erase(display); | 69 pending_displays_.erase(display); |
| 60 } else { | 70 } else { |
| 61 for (const auto& pair : user_display_managers_) | 71 for (const auto& pair : user_display_managers_) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { | 227 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { |
| 218 // TODO(kylechar): Send IPCs to WM clients first. | 228 // TODO(kylechar): Send IPCs to WM clients first. |
| 219 | 229 |
| 220 // Send IPCs to any DisplayManagerObservers. | 230 // Send IPCs to any DisplayManagerObservers. |
| 221 for (const auto& pair : user_display_managers_) | 231 for (const auto& pair : user_display_managers_) |
| 222 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 232 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
| 223 } | 233 } |
| 224 | 234 |
| 225 } // namespace ws | 235 } // namespace ws |
| 226 } // namespace ui | 236 } // namespace ui |
| OLD | NEW |