| 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> |
| 8 |
| 7 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 8 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 9 #include "services/ui/display/platform_screen.h" | 11 #include "services/ui/display/platform_screen.h" |
| 10 #include "services/ui/ws/display.h" | 12 #include "services/ui/ws/display.h" |
| 11 #include "services/ui/ws/display_binding.h" | 13 #include "services/ui/ws/display_binding.h" |
| 12 #include "services/ui/ws/event_dispatcher.h" | 14 #include "services/ui/ws/event_dispatcher.h" |
| 13 #include "services/ui/ws/platform_display_init_params.h" | 15 #include "services/ui/ws/platform_display_init_params.h" |
| 14 #include "services/ui/ws/server_window.h" | 16 #include "services/ui/ws/server_window.h" |
| 15 #include "services/ui/ws/user_display_manager.h" | 17 #include "services/ui/ws/user_display_manager.h" |
| 16 #include "services/ui/ws/user_display_manager_delegate.h" | 18 #include "services/ui/ws/user_display_manager_delegate.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 current_window_manager_state->Activate(mouse_location_on_screen); | 171 current_window_manager_state->Activate(mouse_location_on_screen); |
| 170 } | 172 } |
| 171 | 173 |
| 172 void DisplayManager::OnDisplayAdded(int64_t id, | 174 void DisplayManager::OnDisplayAdded(int64_t id, |
| 173 const display::ViewportMetrics& metrics) { | 175 const display::ViewportMetrics& metrics) { |
| 174 TRACE_EVENT1("mus-ws", "OnDisplayAdded", "id", id); | 176 TRACE_EVENT1("mus-ws", "OnDisplayAdded", "id", id); |
| 175 PlatformDisplayInitParams params; | 177 PlatformDisplayInitParams params; |
| 176 params.display_id = id; | 178 params.display_id = id; |
| 177 params.metrics = metrics; | 179 params.metrics = metrics; |
| 178 | 180 |
| 179 ws::Display* display = new ws::Display(window_server_, params); | 181 ws::Display* display = new ws::Display(window_server_); |
| 180 display->Init(nullptr); | 182 display->Init(params, nullptr); |
| 181 | 183 |
| 182 window_server_->delegate()->UpdateTouchTransforms(); | 184 window_server_->delegate()->UpdateTouchTransforms(); |
| 183 } | 185 } |
| 184 | 186 |
| 185 void DisplayManager::OnDisplayRemoved(int64_t id) { | 187 void DisplayManager::OnDisplayRemoved(int64_t id) { |
| 186 TRACE_EVENT1("mus-ws", "OnDisplayRemoved", "id", id); | 188 TRACE_EVENT1("mus-ws", "OnDisplayRemoved", "id", id); |
| 187 Display* display = GetDisplayById(id); | 189 Display* display = GetDisplayById(id); |
| 188 if (display) | 190 if (display) |
| 189 DestroyDisplay(display); | 191 DestroyDisplay(display); |
| 190 } | 192 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 217 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { | 219 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { |
| 218 // TODO(kylechar): Send IPCs to WM clients first. | 220 // TODO(kylechar): Send IPCs to WM clients first. |
| 219 | 221 |
| 220 // Send IPCs to any DisplayManagerObservers. | 222 // Send IPCs to any DisplayManagerObservers. |
| 221 for (const auto& pair : user_display_managers_) | 223 for (const auto& pair : user_display_managers_) |
| 222 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 224 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
| 223 } | 225 } |
| 224 | 226 |
| 225 } // namespace ws | 227 } // namespace ws |
| 226 } // namespace ui | 228 } // namespace ui |
| OLD | NEW |