| 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/window_server.h" | 5 #include "components/mus/ws/window_server.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 const Display* display = display_manager_->GetDisplayContaining(window); | 479 const Display* display = display_manager_->GetDisplayContaining(window); |
| 480 return display ? display->root_window() : nullptr; | 480 return display ? display->root_window() : nullptr; |
| 481 } | 481 } |
| 482 | 482 |
| 483 void WindowServer::ScheduleSurfaceDestruction(ServerWindow* window) { | 483 void WindowServer::ScheduleSurfaceDestruction(ServerWindow* window) { |
| 484 Display* display = display_manager_->GetDisplayContaining(window); | 484 Display* display = display_manager_->GetDisplayContaining(window); |
| 485 if (display) | 485 if (display) |
| 486 display->ScheduleSurfaceDestruction(window); | 486 display->ScheduleSurfaceDestruction(window); |
| 487 } | 487 } |
| 488 | 488 |
| 489 ServerWindow* WindowServer::FindWindowForSurface( | |
| 490 const ServerWindow* ancestor, | |
| 491 mojom::SurfaceType surface_type, | |
| 492 const ClientWindowId& client_window_id) { | |
| 493 WindowTree* window_tree; | |
| 494 if (ancestor->id().client_id == kInvalidClientId) { | |
| 495 WindowManagerAndDisplay wm_and_display = | |
| 496 display_manager_->GetWindowManagerAndDisplay(ancestor); | |
| 497 window_tree = wm_and_display.window_manager_state | |
| 498 ? wm_and_display.window_manager_state->tree() | |
| 499 : nullptr; | |
| 500 } else { | |
| 501 window_tree = GetTreeWithId(ancestor->id().client_id); | |
| 502 } | |
| 503 if (!window_tree) | |
| 504 return nullptr; | |
| 505 if (surface_type == mojom::SurfaceType::DEFAULT) { | |
| 506 // At embed points the default surface comes from the embedded app. | |
| 507 WindowTree* tree_with_root = GetTreeWithRoot(ancestor); | |
| 508 if (tree_with_root) | |
| 509 window_tree = tree_with_root; | |
| 510 } | |
| 511 return window_tree->GetWindowByClientId(client_window_id); | |
| 512 } | |
| 513 | |
| 514 void WindowServer::OnWindowDestroyed(ServerWindow* window) { | 489 void WindowServer::OnWindowDestroyed(ServerWindow* window) { |
| 515 ProcessWindowDeleted(window); | 490 ProcessWindowDeleted(window); |
| 516 } | 491 } |
| 517 | 492 |
| 518 void WindowServer::OnWillChangeWindowHierarchy(ServerWindow* window, | 493 void WindowServer::OnWillChangeWindowHierarchy(ServerWindow* window, |
| 519 ServerWindow* new_parent, | 494 ServerWindow* new_parent, |
| 520 ServerWindow* old_parent) { | 495 ServerWindow* old_parent) { |
| 521 if (in_destructor_) | 496 if (in_destructor_) |
| 522 return; | 497 return; |
| 523 | 498 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 void WindowServer::OnFirstDisplayReady() { | 655 void WindowServer::OnFirstDisplayReady() { |
| 681 delegate_->OnFirstDisplayReady(); | 656 delegate_->OnFirstDisplayReady(); |
| 682 } | 657 } |
| 683 | 658 |
| 684 void WindowServer::OnNoMoreDisplays() { | 659 void WindowServer::OnNoMoreDisplays() { |
| 685 delegate_->OnNoMoreDisplays(); | 660 delegate_->OnNoMoreDisplays(); |
| 686 } | 661 } |
| 687 | 662 |
| 688 } // namespace ws | 663 } // namespace ws |
| 689 } // namespace mus | 664 } // namespace mus |
| OLD | NEW |