| 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 "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "services/ui/display/platform_screen.h" | 8 #include "services/ui/display/platform_screen.h" |
| 9 #include "services/ui/ws/display.h" | 9 #include "services/ui/ws/display.h" |
| 10 #include "services/ui/ws/display_binding.h" | 10 #include "services/ui/ws/display_binding.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const ServerWindow* window) const { | 97 const ServerWindow* window) const { |
| 98 while (window && window->parent()) | 98 while (window && window->parent()) |
| 99 window = window->parent(); | 99 window = window->parent(); |
| 100 for (Display* display : displays_) { | 100 for (Display* display : displays_) { |
| 101 if (window == display->root_window()) | 101 if (window == display->root_window()) |
| 102 return display; | 102 return display; |
| 103 } | 103 } |
| 104 return nullptr; | 104 return nullptr; |
| 105 } | 105 } |
| 106 | 106 |
| 107 Display* DisplayManager::GetDisplayById(int64_t display_id) { |
| 108 for (Display* display : displays_) { |
| 109 if (display->GetId() == display_id) |
| 110 return display; |
| 111 } |
| 112 return nullptr; |
| 113 } |
| 114 |
| 107 const WindowManagerDisplayRoot* DisplayManager::GetWindowManagerDisplayRoot( | 115 const WindowManagerDisplayRoot* DisplayManager::GetWindowManagerDisplayRoot( |
| 108 const ServerWindow* window) const { | 116 const ServerWindow* window) const { |
| 109 const ServerWindow* last = window; | 117 const ServerWindow* last = window; |
| 110 while (window && window->parent()) { | 118 while (window && window->parent()) { |
| 111 last = window; | 119 last = window; |
| 112 window = window->parent(); | 120 window = window->parent(); |
| 113 } | 121 } |
| 114 for (Display* display : displays_) { | 122 for (Display* display : displays_) { |
| 115 if (window == display->root_window()) | 123 if (window == display->root_window()) |
| 116 return display->GetWindowManagerDisplayRootWithRoot(last); | 124 return display->GetWindowManagerDisplayRootWithRoot(last); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 params.platform_screen = platform_screen; | 176 params.platform_screen = platform_screen; |
| 169 params.surfaces_state = window_server_->GetSurfacesState(); | 177 params.surfaces_state = window_server_->GetSurfacesState(); |
| 170 | 178 |
| 171 ws::Display* display = new ws::Display(window_server_, params); | 179 ws::Display* display = new ws::Display(window_server_, params); |
| 172 display->Init(nullptr); | 180 display->Init(nullptr); |
| 173 | 181 |
| 174 window_server_->delegate()->UpdateTouchTransforms(); | 182 window_server_->delegate()->UpdateTouchTransforms(); |
| 175 } | 183 } |
| 176 | 184 |
| 177 void DisplayManager::OnDisplayRemoved(int64_t id) { | 185 void DisplayManager::OnDisplayRemoved(int64_t id) { |
| 178 // TODO(kylechar): Implement. | 186 Display* display = GetDisplayById(id); |
| 179 NOTREACHED(); | 187 if (display) |
| 188 DestroyDisplay(display); |
| 189 // TODO(kylechar): What if the display is still pending? |
| 180 } | 190 } |
| 181 | 191 |
| 182 void DisplayManager::OnDisplayModified(int64_t id, const gfx::Rect& bounds) { | 192 void DisplayManager::OnDisplayModified(int64_t id, const gfx::Rect& bounds) { |
| 183 // TODO(kylechar): Implement. | 193 // TODO(kylechar): Implement. |
| 184 NOTREACHED(); | 194 NOTREACHED(); |
| 185 } | 195 } |
| 186 | 196 |
| 187 } // namespace ws | 197 } // namespace ws |
| 188 } // namespace ui | 198 } // namespace ui |
| OLD | NEW |