| 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_tree_impl.h" | 5 #include "components/mus/ws/window_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "components/mus/ws/client_connection.h" | 13 #include "components/mus/ws/client_connection.h" |
| 14 #include "components/mus/ws/connection_manager.h" | 14 #include "components/mus/ws/connection_manager.h" |
| 15 #include "components/mus/ws/default_access_policy.h" | 15 #include "components/mus/ws/default_access_policy.h" |
| 16 #include "components/mus/ws/display_manager.h" | 16 #include "components/mus/ws/display_manager.h" |
| 17 #include "components/mus/ws/focus_controller.h" | 17 #include "components/mus/ws/focus_controller.h" |
| 18 #include "components/mus/ws/operation.h" | 18 #include "components/mus/ws/operation.h" |
| 19 #include "components/mus/ws/server_window.h" | 19 #include "components/mus/ws/server_window.h" |
| 20 #include "components/mus/ws/server_window_observer.h" | 20 #include "components/mus/ws/server_window_observer.h" |
| 21 #include "components/mus/ws/window_manager_access_policy.h" | 21 #include "components/mus/ws/window_manager_access_policy.h" |
| 22 #include "components/mus/ws/window_manager_state.h" |
| 22 #include "components/mus/ws/window_tree_host_impl.h" | 23 #include "components/mus/ws/window_tree_host_impl.h" |
| 23 #include "mojo/converters/geometry/geometry_type_converters.h" | 24 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 24 #include "mojo/converters/ime/ime_type_converters.h" | 25 #include "mojo/converters/ime/ime_type_converters.h" |
| 25 #include "mojo/converters/input_events/input_events_type_converters.h" | 26 #include "mojo/converters/input_events/input_events_type_converters.h" |
| 26 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 27 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 27 #include "ui/platform_window/text_input_state.h" | 28 #include "ui/platform_window/text_input_state.h" |
| 28 | 29 |
| 29 using mojo::Array; | 30 using mojo::Array; |
| 30 using mojo::Callback; | 31 using mojo::Callback; |
| 31 using mojo::InterfaceRequest; | 32 using mojo::InterfaceRequest; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 : connection_manager_(connection_manager), | 70 : connection_manager_(connection_manager), |
| 70 id_(connection_manager_->GetAndAdvanceNextConnectionId()), | 71 id_(connection_manager_->GetAndAdvanceNextConnectionId()), |
| 71 next_window_id_(1), | 72 next_window_id_(1), |
| 72 client_(nullptr), | 73 client_(nullptr), |
| 73 event_ack_id_(0), | 74 event_ack_id_(0), |
| 74 event_source_host_(nullptr), | 75 event_source_host_(nullptr), |
| 75 is_embed_root_(false), | 76 is_embed_root_(false), |
| 76 window_manager_internal_(nullptr) { | 77 window_manager_internal_(nullptr) { |
| 77 if (root) | 78 if (root) |
| 78 roots_.insert(root); | 79 roots_.insert(root); |
| 79 if (root && root->GetRoot() == root) { | 80 // TODO(sky): pass in type rather than inferring it. |
| 81 if (root && root->id().connection_id == kInvalidConnectionId) { |
| 80 access_policy_.reset(new WindowManagerAccessPolicy(id_, this)); | 82 access_policy_.reset(new WindowManagerAccessPolicy(id_, this)); |
| 81 is_embed_root_ = true; | 83 is_embed_root_ = true; |
| 82 } else { | 84 } else { |
| 83 access_policy_.reset(new DefaultAccessPolicy(id_, this)); | 85 access_policy_.reset(new DefaultAccessPolicy(id_, this)); |
| 84 is_embed_root_ = (policy_bitmask & WindowTree::kAccessPolicyEmbedRoot) != 0; | 86 is_embed_root_ = (policy_bitmask & WindowTree::kAccessPolicyEmbedRoot) != 0; |
| 85 } | 87 } |
| 86 } | 88 } |
| 87 | 89 |
| 88 WindowTreeImpl::~WindowTreeImpl() { | 90 WindowTreeImpl::~WindowTreeImpl() { |
| 89 DestroyWindows(); | 91 DestroyWindows(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 | 405 |
| 404 client_->OnWindowSharedPropertyChanged(client_window_id.id, String(name), | 406 client_->OnWindowSharedPropertyChanged(client_window_id.id, String(name), |
| 405 std::move(data)); | 407 std::move(data)); |
| 406 } | 408 } |
| 407 | 409 |
| 408 void WindowTreeImpl::ProcessWindowHierarchyChanged( | 410 void WindowTreeImpl::ProcessWindowHierarchyChanged( |
| 409 const ServerWindow* window, | 411 const ServerWindow* window, |
| 410 const ServerWindow* new_parent, | 412 const ServerWindow* new_parent, |
| 411 const ServerWindow* old_parent, | 413 const ServerWindow* old_parent, |
| 412 bool originated_change) { | 414 bool originated_change) { |
| 413 if (originated_change && !IsWindowKnown(window) && new_parent && | 415 const bool knows_new = new_parent && IsWindowKnown(new_parent); |
| 414 IsWindowKnown(new_parent)) { | 416 if (originated_change && !IsWindowKnown(window) && knows_new) { |
| 415 std::vector<const ServerWindow*> unused; | 417 std::vector<const ServerWindow*> unused; |
| 416 GetUnknownWindowsFrom(window, &unused); | 418 GetUnknownWindowsFrom(window, &unused); |
| 417 } | 419 } |
| 418 if (originated_change || (connection_manager_->current_operation_type() == | 420 if (originated_change || (connection_manager_->current_operation_type() == |
| 419 OperationType::DELETE_WINDOW) || | 421 OperationType::DELETE_WINDOW) || |
| 420 (connection_manager_->current_operation_type() == OperationType::EMBED) || | 422 (connection_manager_->current_operation_type() == OperationType::EMBED) || |
| 421 connection_manager_->DidConnectionMessageClient(id_)) { | 423 connection_manager_->DidConnectionMessageClient(id_)) { |
| 422 return; | 424 return; |
| 423 } | 425 } |
| 424 | 426 |
| 425 if (!access_policy_->ShouldNotifyOnHierarchyChange(window, &new_parent, | 427 if (!access_policy_->ShouldNotifyOnHierarchyChange(window, &new_parent, |
| 426 &old_parent)) { | 428 &old_parent)) { |
| 427 return; | 429 return; |
| 428 } | 430 } |
| 429 // Inform the client of any new windows and update the set of windows we know | 431 // Inform the client of any new windows and update the set of windows we know |
| 430 // about. | 432 // about. |
| 431 std::vector<const ServerWindow*> to_send; | 433 std::vector<const ServerWindow*> to_send; |
| 432 if (!IsWindowKnown(window)) | 434 if (!IsWindowKnown(window)) |
| 433 GetUnknownWindowsFrom(window, &to_send); | 435 GetUnknownWindowsFrom(window, &to_send); |
| 436 const bool knows_old = old_parent && IsWindowKnown(old_parent); |
| 437 if (!knows_old && !knows_new) |
| 438 return; |
| 439 |
| 434 const ClientWindowId new_parent_client_window_id = | 440 const ClientWindowId new_parent_client_window_id = |
| 435 new_parent ? ClientWindowIdForWindow(new_parent) : ClientWindowId(); | 441 knows_new ? ClientWindowIdForWindow(new_parent) : ClientWindowId(); |
| 436 const ClientWindowId old_parent_client_window_id = | 442 const ClientWindowId old_parent_client_window_id = |
| 437 old_parent ? ClientWindowIdForWindow(old_parent) : ClientWindowId(); | 443 knows_old ? ClientWindowIdForWindow(old_parent) : ClientWindowId(); |
| 438 const ClientWindowId client_window_id = | 444 const ClientWindowId client_window_id = |
| 439 window ? ClientWindowIdForWindow(window) : ClientWindowId(); | 445 window ? ClientWindowIdForWindow(window) : ClientWindowId(); |
| 440 client_->OnWindowHierarchyChanged( | 446 client_->OnWindowHierarchyChanged( |
| 441 client_window_id.id, new_parent_client_window_id.id, | 447 client_window_id.id, new_parent_client_window_id.id, |
| 442 old_parent_client_window_id.id, WindowsToWindowDatas(to_send)); | 448 old_parent_client_window_id.id, WindowsToWindowDatas(to_send)); |
| 443 connection_manager_->OnConnectionMessagedClient(id_); | 449 connection_manager_->OnConnectionMessagedClient(id_); |
| 444 } | 450 } |
| 445 | 451 |
| 446 void WindowTreeImpl::ProcessWindowReorder(const ServerWindow* window, | 452 void WindowTreeImpl::ProcessWindowReorder(const ServerWindow* window, |
| 447 const ServerWindow* relative_window, | 453 const ServerWindow* relative_window, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 } | 576 } |
| 571 | 577 |
| 572 WindowTreeHostImpl* WindowTreeImpl::GetHostForWindowManager() { | 578 WindowTreeHostImpl* WindowTreeImpl::GetHostForWindowManager() { |
| 573 // The WindowTreeImpl for the wm has one and only one root. | 579 // The WindowTreeImpl for the wm has one and only one root. |
| 574 CHECK_EQ(1u, roots_.size()); | 580 CHECK_EQ(1u, roots_.size()); |
| 575 | 581 |
| 576 // Indicates this connection is for the wm. | 582 // Indicates this connection is for the wm. |
| 577 DCHECK(window_manager_internal_); | 583 DCHECK(window_manager_internal_); |
| 578 | 584 |
| 579 WindowTreeHostImpl* host = GetHost(*roots_.begin()); | 585 WindowTreeHostImpl* host = GetHost(*roots_.begin()); |
| 580 CHECK(host); | 586 WindowManagerAndHost wm_and_host = |
| 581 DCHECK_EQ(this, host->GetWindowTree()); | 587 connection_manager_->GetWindowManagerAndHost(*roots_.begin()); |
| 588 CHECK(wm_and_host.window_tree_host); |
| 589 CHECK(wm_and_host.window_manager_state); |
| 590 DCHECK_EQ(this, wm_and_host.window_manager_state->tree()); |
| 582 return host; | 591 return host; |
| 583 } | 592 } |
| 584 | 593 |
| 585 bool WindowTreeImpl::ShouldRouteToWindowManager( | 594 bool WindowTreeImpl::ShouldRouteToWindowManager( |
| 586 const ServerWindow* window) const { | 595 const ServerWindow* window) const { |
| 587 // If the client created this window, then do not route it through the WM. | 596 // If the client created this window, then do not route it through the WM. |
| 588 if (window->id().connection_id == id_) | 597 if (window->id().connection_id == id_) |
| 589 return false; | 598 return false; |
| 590 | 599 |
| 591 // If the client did not create the window, then it must be the root of the | 600 // If the client did not create the window, then it must be the root of the |
| 592 // client. If not, that means the client should not know about this window, | 601 // client. If not, that means the client should not know about this window, |
| 593 // and so do not route the request to the WM. | 602 // and so do not route the request to the WM. |
| 594 if (roots_.count(window) == 0) | 603 if (roots_.count(window) == 0) |
| 595 return false; | 604 return false; |
| 596 | 605 |
| 597 // The WindowManager is attached to the root of the WindowTreeHost, if there | 606 // The WindowManager is attached to the root of the WindowTreeHost, if there |
| 598 // isn't a WindowManager attached no need to route to it. | 607 // isn't a WindowManager attached no need to route to it. |
| 599 const WindowTreeHostImpl* host = GetHost(window); | 608 const WindowManagerState* wms = |
| 600 if (!host || !host->GetWindowTree() || | 609 connection_manager_->GetWindowManagerAndHost(window).window_manager_state; |
| 601 !host->GetWindowTree()->window_manager_internal_) { | 610 if (!wms || !wms->tree()->window_manager_internal_) |
| 602 return false; | 611 return false; |
| 603 } | |
| 604 | 612 |
| 605 // Requests coming from the WM should not be routed through the WM again. | 613 // Requests coming from the WM should not be routed through the WM again. |
| 606 const bool is_wm = host->GetWindowTree() == this; | 614 const bool is_wm = wms->tree() == this; |
| 607 return is_wm ? false : true; | 615 return is_wm ? false : true; |
| 608 } | 616 } |
| 609 | 617 |
| 610 void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window, | 618 void WindowTreeImpl::ProcessLostCapture(const ServerWindow* old_capture_window, |
| 611 bool originated_change) { | 619 bool originated_change) { |
| 612 if ((originated_change && | 620 if ((originated_change && |
| 613 connection_manager_->current_operation_type() == | 621 connection_manager_->current_operation_type() == |
| 614 OperationType::RELEASE_CAPTURE) || | 622 OperationType::RELEASE_CAPTURE) || |
| 615 !IsWindowKnown(old_capture_window)) { | 623 !IsWindowKnown(old_capture_window)) { |
| 616 return; | 624 return; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 client_->OnChangeCompleted( | 899 client_->OnChangeCompleted( |
| 892 change_id, NewWindow(ClientWindowId(transport_window_id), properties)); | 900 change_id, NewWindow(ClientWindowId(transport_window_id), properties)); |
| 893 } | 901 } |
| 894 | 902 |
| 895 void WindowTreeImpl::NewTopLevelWindow( | 903 void WindowTreeImpl::NewTopLevelWindow( |
| 896 uint32_t change_id, | 904 uint32_t change_id, |
| 897 Id transport_window_id, | 905 Id transport_window_id, |
| 898 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { | 906 mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) { |
| 899 DCHECK(!waiting_for_top_level_window_info_); | 907 DCHECK(!waiting_for_top_level_window_info_); |
| 900 const ClientWindowId client_window_id(transport_window_id); | 908 const ClientWindowId client_window_id(transport_window_id); |
| 901 // TODO(sky): need a way for client to provide context. | |
| 902 WindowTreeHostImpl* tree_host = | 909 WindowTreeHostImpl* tree_host = |
| 903 connection_manager_->GetActiveWindowTreeHost(); | 910 connection_manager_->GetActiveWindowTreeHost(); |
| 904 if (!tree_host || tree_host->GetWindowTree() == this || | 911 // TODO(sky): need a way for client to provide context. |
| 905 !IsValidIdForNewWindow(client_window_id)) { | 912 WindowManagerState* wms = |
| 913 tree_host ? tree_host->GetFirstWindowManagerState() : nullptr; |
| 914 if (!wms || wms->tree() == this || !IsValidIdForNewWindow(client_window_id)) { |
| 906 client_->OnChangeCompleted(change_id, false); | 915 client_->OnChangeCompleted(change_id, false); |
| 907 return; | 916 return; |
| 908 } | 917 } |
| 909 | 918 |
| 910 // The server creates the real window. Any further messages from the client | 919 // The server creates the real window. Any further messages from the client |
| 911 // may try to alter the window. Pause incoming messages so that we know we | 920 // may try to alter the window. Pause incoming messages so that we know we |
| 912 // can't get a message for a window before the window is created. Once the | 921 // can't get a message for a window before the window is created. Once the |
| 913 // window is created we'll resume processing. | 922 // window is created we'll resume processing. |
| 914 connection_manager_->GetClientConnection(this) | 923 connection_manager_->GetClientConnection(this) |
| 915 ->SetIncomingMethodCallProcessingPaused(true); | 924 ->SetIncomingMethodCallProcessingPaused(true); |
| 916 | 925 |
| 917 const uint32_t wm_change_id = | 926 const uint32_t wm_change_id = |
| 918 connection_manager_->GenerateWindowManagerChangeId(this, change_id); | 927 connection_manager_->GenerateWindowManagerChangeId(this, change_id); |
| 919 | 928 |
| 920 waiting_for_top_level_window_info_.reset( | 929 waiting_for_top_level_window_info_.reset( |
| 921 new WaitingForTopLevelWindowInfo(client_window_id, wm_change_id)); | 930 new WaitingForTopLevelWindowInfo(client_window_id, wm_change_id)); |
| 922 | 931 |
| 923 tree_host->GetWindowTree()->window_manager_internal_->WmCreateTopLevelWindow( | 932 wms->tree()->window_manager_internal_->WmCreateTopLevelWindow( |
| 924 wm_change_id, std::move(transport_properties)); | 933 wm_change_id, std::move(transport_properties)); |
| 925 } | 934 } |
| 926 | 935 |
| 927 void WindowTreeImpl::DeleteWindow(uint32_t change_id, Id transport_window_id) { | 936 void WindowTreeImpl::DeleteWindow(uint32_t change_id, Id transport_window_id) { |
| 928 ServerWindow* window = | 937 ServerWindow* window = |
| 929 GetWindowByClientId(ClientWindowId(transport_window_id)); | 938 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 930 bool success = false; | 939 bool success = false; |
| 931 bool should_close = window && (access_policy_->CanDeleteWindow(window) || | 940 bool should_close = window && (access_policy_->CanDeleteWindow(window) || |
| 932 ShouldRouteToWindowManager(window)); | 941 ShouldRouteToWindowManager(window)); |
| 933 if (should_close) { | 942 if (should_close) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1049 |
| 1041 void WindowTreeImpl::SetWindowBounds(uint32_t change_id, | 1050 void WindowTreeImpl::SetWindowBounds(uint32_t change_id, |
| 1042 Id window_id, | 1051 Id window_id, |
| 1043 mojo::RectPtr bounds) { | 1052 mojo::RectPtr bounds) { |
| 1044 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1053 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
| 1045 if (window && ShouldRouteToWindowManager(window)) { | 1054 if (window && ShouldRouteToWindowManager(window)) { |
| 1046 const uint32_t wm_change_id = | 1055 const uint32_t wm_change_id = |
| 1047 connection_manager_->GenerateWindowManagerChangeId(this, change_id); | 1056 connection_manager_->GenerateWindowManagerChangeId(this, change_id); |
| 1048 // |window_id| may be a client id, use the id from the window to ensure | 1057 // |window_id| may be a client id, use the id from the window to ensure |
| 1049 // the windowmanager doesn't get an id it doesn't know about. | 1058 // the windowmanager doesn't get an id it doesn't know about. |
| 1050 WindowTreeImpl* wm_window_tree = GetHost(window)->GetWindowTree(); | 1059 WindowManagerState* wms = |
| 1051 wm_window_tree->window_manager_internal_->WmSetBounds( | 1060 connection_manager_->GetWindowManagerAndHost(window) |
| 1052 wm_change_id, wm_window_tree->ClientWindowIdForWindow(window).id, | 1061 .window_manager_state; |
| 1062 wms->tree()->window_manager_internal_->WmSetBounds( |
| 1063 wm_change_id, wms->tree()->ClientWindowIdForWindow(window).id, |
| 1053 std::move(bounds)); | 1064 std::move(bounds)); |
| 1054 return; | 1065 return; |
| 1055 } | 1066 } |
| 1056 | 1067 |
| 1057 // Only the owner of the window can change the bounds. | 1068 // Only the owner of the window can change the bounds. |
| 1058 bool success = window && access_policy_->CanSetWindowBounds(window); | 1069 bool success = window && access_policy_->CanSetWindowBounds(window); |
| 1059 if (success) { | 1070 if (success) { |
| 1060 Operation op(this, connection_manager_, OperationType::SET_WINDOW_BOUNDS); | 1071 Operation op(this, connection_manager_, OperationType::SET_WINDOW_BOUNDS); |
| 1061 window->SetBounds(bounds.To<gfx::Rect>()); | 1072 window->SetBounds(bounds.To<gfx::Rect>()); |
| 1062 } | 1073 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1073 | 1084 |
| 1074 void WindowTreeImpl::SetWindowProperty(uint32_t change_id, | 1085 void WindowTreeImpl::SetWindowProperty(uint32_t change_id, |
| 1075 Id transport_window_id, | 1086 Id transport_window_id, |
| 1076 const mojo::String& name, | 1087 const mojo::String& name, |
| 1077 mojo::Array<uint8_t> value) { | 1088 mojo::Array<uint8_t> value) { |
| 1078 ServerWindow* window = | 1089 ServerWindow* window = |
| 1079 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1090 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 1080 if (window && ShouldRouteToWindowManager(window)) { | 1091 if (window && ShouldRouteToWindowManager(window)) { |
| 1081 const uint32_t wm_change_id = | 1092 const uint32_t wm_change_id = |
| 1082 connection_manager_->GenerateWindowManagerChangeId(this, change_id); | 1093 connection_manager_->GenerateWindowManagerChangeId(this, change_id); |
| 1083 WindowTreeImpl* wm_window_tree = GetHost(window)->GetWindowTree(); | 1094 WindowManagerState* wms = |
| 1084 wm_window_tree->window_manager_internal_->WmSetProperty( | 1095 connection_manager_->GetWindowManagerAndHost(window) |
| 1085 wm_change_id, wm_window_tree->ClientWindowIdForWindow(window).id, name, | 1096 .window_manager_state; |
| 1097 wms->tree()->window_manager_internal_->WmSetProperty( |
| 1098 wm_change_id, wms->tree()->ClientWindowIdForWindow(window).id, name, |
| 1086 std::move(value)); | 1099 std::move(value)); |
| 1087 return; | 1100 return; |
| 1088 } | 1101 } |
| 1089 const bool success = window && access_policy_->CanSetWindowProperties(window); | 1102 const bool success = window && access_policy_->CanSetWindowProperties(window); |
| 1090 if (success) { | 1103 if (success) { |
| 1091 Operation op(this, connection_manager_, OperationType::SET_WINDOW_PROPERTY); | 1104 Operation op(this, connection_manager_, OperationType::SET_WINDOW_PROPERTY); |
| 1092 if (value.is_null()) { | 1105 if (value.is_null()) { |
| 1093 window->SetProperty(name, nullptr); | 1106 window->SetProperty(name, nullptr); |
| 1094 } else { | 1107 } else { |
| 1095 std::vector<uint8_t> data = value.To<std::vector<uint8_t>>(); | 1108 std::vector<uint8_t> data = value.To<std::vector<uint8_t>>(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 void WindowTreeImpl::WmRequestClose(Id transport_window_id) { | 1322 void WindowTreeImpl::WmRequestClose(Id transport_window_id) { |
| 1310 // Only the WindowManager should be using this. | 1323 // Only the WindowManager should be using this. |
| 1311 WindowTreeHostImpl* host = GetHostForWindowManager(); | 1324 WindowTreeHostImpl* host = GetHostForWindowManager(); |
| 1312 if (!host) | 1325 if (!host) |
| 1313 return; | 1326 return; |
| 1314 | 1327 |
| 1315 ServerWindow* window = | 1328 ServerWindow* window = |
| 1316 GetWindowByClientId(ClientWindowId(transport_window_id)); | 1329 GetWindowByClientId(ClientWindowId(transport_window_id)); |
| 1317 WindowTreeImpl* connection = | 1330 WindowTreeImpl* connection = |
| 1318 connection_manager_->GetConnectionWithRoot(window); | 1331 connection_manager_->GetConnectionWithRoot(window); |
| 1319 if (connection && connection != host->GetWindowTree()) | 1332 if (connection && connection != this) { |
| 1320 connection->client_->RequestClose( | 1333 connection->client_->RequestClose( |
| 1321 connection->ClientWindowIdForWindow(window).id); | 1334 connection->ClientWindowIdForWindow(window).id); |
| 1335 } |
| 1322 // TODO(sky): think about what else case means. | 1336 // TODO(sky): think about what else case means. |
| 1323 } | 1337 } |
| 1324 | 1338 |
| 1325 void WindowTreeImpl::WmSetFrameDecorationValues( | 1339 void WindowTreeImpl::WmSetFrameDecorationValues( |
| 1326 mojom::FrameDecorationValuesPtr values) { | 1340 mojom::FrameDecorationValuesPtr values) { |
| 1327 if (GetHostForWindowManager()) | 1341 if (GetHostForWindowManager()) |
| 1328 GetHostForWindowManager()->SetFrameDecorationValues(std::move(values)); | 1342 GetHostForWindowManager()->SetFrameDecorationValues(std::move(values)); |
| 1329 } | 1343 } |
| 1330 | 1344 |
| 1331 void WindowTreeImpl::OnWmCreatedTopLevelWindow(uint32_t change_id, | 1345 void WindowTreeImpl::OnWmCreatedTopLevelWindow(uint32_t change_id, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1379 |
| 1366 for (const auto* root : roots_) { | 1380 for (const auto* root : roots_) { |
| 1367 if (root->Contains(window)) | 1381 if (root->Contains(window)) |
| 1368 return true; | 1382 return true; |
| 1369 } | 1383 } |
| 1370 return false; | 1384 return false; |
| 1371 } | 1385 } |
| 1372 | 1386 |
| 1373 } // namespace ws | 1387 } // namespace ws |
| 1374 } // namespace mus | 1388 } // namespace mus |
| OLD | NEW |