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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 528 |
529 void ConnectionManager::ScheduleSurfaceDestruction(ServerWindow* window) { | 529 void ConnectionManager::ScheduleSurfaceDestruction(ServerWindow* window) { |
530 for (auto& pair : host_connection_map_) { | 530 for (auto& pair : host_connection_map_) { |
531 if (pair.first->root_window()->Contains(window)) { | 531 if (pair.first->root_window()->Contains(window)) { |
532 pair.first->ScheduleSurfaceDestruction(window); | 532 pair.first->ScheduleSurfaceDestruction(window); |
533 break; | 533 break; |
534 } | 534 } |
535 } | 535 } |
536 } | 536 } |
537 | 537 |
| 538 ServerWindow* ConnectionManager::FindWindowForSurface( |
| 539 const ServerWindow* ancestor, |
| 540 mojom::SurfaceType surface_type, |
| 541 const ClientWindowId& client_window_id) { |
| 542 WindowTreeImpl* window_tree = GetConnection(ancestor->id().connection_id); |
| 543 if (!window_tree) |
| 544 return nullptr; |
| 545 if (surface_type == mojom::SurfaceType::DEFAULT) { |
| 546 // At embed points the default surface comes from the embedded app. |
| 547 WindowTreeImpl* connection_with_root = GetConnectionWithRoot(ancestor); |
| 548 if (connection_with_root) |
| 549 window_tree = connection_with_root; |
| 550 } |
| 551 return window_tree->GetWindowByClientId(client_window_id); |
| 552 } |
| 553 |
538 void ConnectionManager::OnWindowDestroyed(ServerWindow* window) { | 554 void ConnectionManager::OnWindowDestroyed(ServerWindow* window) { |
539 if (!in_destructor_) | 555 if (!in_destructor_) |
540 ProcessWindowDeleted(window); | 556 ProcessWindowDeleted(window); |
541 } | 557 } |
542 | 558 |
543 void ConnectionManager::OnWillChangeWindowHierarchy(ServerWindow* window, | 559 void ConnectionManager::OnWillChangeWindowHierarchy(ServerWindow* window, |
544 ServerWindow* new_parent, | 560 ServerWindow* new_parent, |
545 ServerWindow* old_parent) { | 561 ServerWindow* old_parent) { |
546 if (in_destructor_) | 562 if (in_destructor_) |
547 return; | 563 return; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 if (!got_valid_frame_decorations_) { | 689 if (!got_valid_frame_decorations_) { |
674 display_manager_observers_.AddInterfacePtr(std::move(observer)); | 690 display_manager_observers_.AddInterfacePtr(std::move(observer)); |
675 return; | 691 return; |
676 } | 692 } |
677 CallOnDisplays(observer.get()); | 693 CallOnDisplays(observer.get()); |
678 display_manager_observers_.AddInterfacePtr(std::move(observer)); | 694 display_manager_observers_.AddInterfacePtr(std::move(observer)); |
679 } | 695 } |
680 | 696 |
681 } // namespace ws | 697 } // namespace ws |
682 } // namespace mus | 698 } // namespace mus |
OLD | NEW |