| 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 "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "services/ui/display/platform_screen.h" | 9 #include "services/ui/display/platform_screen.h" |
| 10 #include "services/ui/ws/display.h" | 10 #include "services/ui/ws/display.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 std::set<const Display*> DisplayManager::displays() const { | 84 std::set<const Display*> DisplayManager::displays() const { |
| 85 std::set<const Display*> ret_value(displays_.begin(), displays_.end()); | 85 std::set<const Display*> ret_value(displays_.begin(), displays_.end()); |
| 86 return ret_value; | 86 return ret_value; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void DisplayManager::OnDisplayUpdate(Display* display) { | 89 void DisplayManager::OnDisplayUpdate(Display* display) { |
| 90 for (const auto& pair : user_display_managers_) | 90 for (const auto& pair : user_display_managers_) |
| 91 pair.second->OnDisplayUpdate(display); | 91 pair.second->OnDisplayUpdate(display); |
| 92 } | 92 } |
| 93 | 93 |
| 94 Display* DisplayManager::GetDisplayContaining(ServerWindow* window) { | 94 Display* DisplayManager::GetDisplayContaining(const ServerWindow* window) { |
| 95 return const_cast<Display*>( | 95 return const_cast<Display*>( |
| 96 static_cast<const DisplayManager*>(this)->GetDisplayContaining(window)); | 96 static_cast<const DisplayManager*>(this)->GetDisplayContaining(window)); |
| 97 } | 97 } |
| 98 | 98 |
| 99 const Display* DisplayManager::GetDisplayContaining( | 99 const Display* DisplayManager::GetDisplayContaining( |
| 100 const ServerWindow* window) const { | 100 const ServerWindow* window) const { |
| 101 while (window && window->parent()) | 101 while (window && window->parent()) |
| 102 window = window->parent(); | 102 window = window->parent(); |
| 103 for (Display* display : displays_) { | 103 for (Display* display : displays_) { |
| 104 if (window == display->root_window()) | 104 if (window == display->root_window()) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { | 216 void DisplayManager::OnPrimaryDisplayChanged(int64_t primary_display_id) { |
| 217 // TODO(kylechar): Send IPCs to WM clients first. | 217 // TODO(kylechar): Send IPCs to WM clients first. |
| 218 | 218 |
| 219 // Send IPCs to any DisplayManagerObservers. | 219 // Send IPCs to any DisplayManagerObservers. |
| 220 for (const auto& pair : user_display_managers_) | 220 for (const auto& pair : user_display_managers_) |
| 221 pair.second->OnPrimaryDisplayChanged(primary_display_id); | 221 pair.second->OnPrimaryDisplayChanged(primary_display_id); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace ws | 224 } // namespace ws |
| 225 } // namespace ui | 225 } // namespace ui |
| OLD | NEW |