| 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/connection_manager.h" | 5 #include "components/mus/ws/connection_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "components/mus/ws/client_connection.h" | 9 #include "components/mus/ws/client_connection.h" |
| 10 #include "components/mus/ws/connection_manager_delegate.h" | 10 #include "components/mus/ws/connection_manager_delegate.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 | 278 |
| 279 WindowTreeImpl* connection = GetConnection(change.connection_id); | 279 WindowTreeImpl* connection = GetConnection(change.connection_id); |
| 280 connection->OnChangeCompleted(change.client_change_id, success); | 280 connection->OnChangeCompleted(change.client_change_id, success); |
| 281 } | 281 } |
| 282 | 282 |
| 283 void ConnectionManager::WindowManagerCreatedTopLevelWindow( | 283 void ConnectionManager::WindowManagerCreatedTopLevelWindow( |
| 284 WindowTreeImpl* wm_connection, | 284 WindowTreeImpl* wm_connection, |
| 285 uint32_t window_manager_change_id, | 285 uint32_t window_manager_change_id, |
| 286 Id transport_window_id) { | 286 const ServerWindow* window) { |
| 287 InFlightWindowManagerChange change; | 287 InFlightWindowManagerChange change; |
| 288 if (!GetAndClearInFlightWindowManagerChange(window_manager_change_id, | 288 if (!GetAndClearInFlightWindowManagerChange(window_manager_change_id, |
| 289 &change)) { | 289 &change)) { |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 if (!window) { |
| 293 WindowManagerSentBogusMessage(); |
| 294 return; |
| 295 } |
| 292 | 296 |
| 293 const WindowId window_id(WindowIdFromTransportId(transport_window_id)); | |
| 294 const ServerWindow* window = GetWindow(window_id); | |
| 295 WindowTreeImpl* connection = GetConnection(change.connection_id); | 297 WindowTreeImpl* connection = GetConnection(change.connection_id); |
| 296 // The window manager should have created the window already, and it should | 298 // The window manager should have created the window already, and it should |
| 297 // be ready for embedding. | 299 // be ready for embedding. |
| 298 if (!connection->IsWaitingForNewTopLevelWindow(window_manager_change_id) || | 300 if (!connection->IsWaitingForNewTopLevelWindow(window_manager_change_id) || |
| 299 !window || window->id().connection_id != wm_connection->id() || | 301 !window || window->id().connection_id != wm_connection->id() || |
| 300 !window->children().empty() || GetConnectionWithRoot(window)) { | 302 !window->children().empty() || GetConnectionWithRoot(window)) { |
| 301 WindowManagerSentBogusMessage(connection); | 303 WindowManagerSentBogusMessage(); |
| 302 return; | 304 return; |
| 303 } | 305 } |
| 304 | 306 |
| 305 connection->OnWindowManagerCreatedTopLevelWindow( | 307 connection->OnWindowManagerCreatedTopLevelWindow( |
| 306 window_manager_change_id, change.client_change_id, window_id); | 308 window_manager_change_id, change.client_change_id, window); |
| 307 } | 309 } |
| 308 | 310 |
| 309 void ConnectionManager::ProcessWindowBoundsChanged( | 311 void ConnectionManager::ProcessWindowBoundsChanged( |
| 310 const ServerWindow* window, | 312 const ServerWindow* window, |
| 311 const gfx::Rect& old_bounds, | 313 const gfx::Rect& old_bounds, |
| 312 const gfx::Rect& new_bounds) { | 314 const gfx::Rect& new_bounds) { |
| 313 for (auto& pair : connection_map_) { | 315 for (auto& pair : connection_map_) { |
| 314 pair.second->service()->ProcessWindowBoundsChanged( | 316 pair.second->service()->ProcessWindowBoundsChanged( |
| 315 window, old_bounds, new_bounds, IsOperationSource(pair.first)); | 317 window, old_bounds, new_bounds, IsOperationSource(pair.first)); |
| 316 } | 318 } |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 if (!got_valid_frame_decorations_) { | 673 if (!got_valid_frame_decorations_) { |
| 672 display_manager_observers_.AddInterfacePtr(std::move(observer)); | 674 display_manager_observers_.AddInterfacePtr(std::move(observer)); |
| 673 return; | 675 return; |
| 674 } | 676 } |
| 675 CallOnDisplays(observer.get()); | 677 CallOnDisplays(observer.get()); |
| 676 display_manager_observers_.AddInterfacePtr(std::move(observer)); | 678 display_manager_observers_.AddInterfacePtr(std::move(observer)); |
| 677 } | 679 } |
| 678 | 680 |
| 679 } // namespace ws | 681 } // namespace ws |
| 680 } // namespace mus | 682 } // namespace mus |
| OLD | NEW |