| 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 "ui/aura/mus/window_tree_client.h" | 5 #include "ui/aura/mus/window_tree_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 : ChangeType::NEW_WINDOW)); | 585 : ChangeType::NEW_WINDOW)); |
| 586 if (create_top_level) { | 586 if (create_top_level) { |
| 587 tree_->NewTopLevelWindow(change_id, window->server_id(), | 587 tree_->NewTopLevelWindow(change_id, window->server_id(), |
| 588 std::move(transport_properties)); | 588 std::move(transport_properties)); |
| 589 } else { | 589 } else { |
| 590 tree_->NewWindow(change_id, window->server_id(), | 590 tree_->NewWindow(change_id, window->server_id(), |
| 591 std::move(transport_properties)); | 591 std::move(transport_properties)); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window) { | 595 void WindowTreeClient::OnWindowMusDestroyed(WindowMus* window, Origin origin) { |
| 596 if (focus_synchronizer_->focused_window() == window) | 596 if (focus_synchronizer_->focused_window() == window) |
| 597 focus_synchronizer_->OnFocusedWindowDestroyed(); | 597 focus_synchronizer_->OnFocusedWindowDestroyed(); |
| 598 | 598 |
| 599 // TODO: decide how to deal with windows not owned by this client. | 599 // TODO: decide how to deal with windows not owned by this client. |
| 600 if (WasCreatedByThisClient(window) || IsRoot(window)) { | 600 if (origin == Origin::CLIENT && |
| 601 (WasCreatedByThisClient(window) || IsRoot(window))) { |
| 601 const uint32_t change_id = | 602 const uint32_t change_id = |
| 602 ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>( | 603 ScheduleInFlightChange(base::MakeUnique<CrashInFlightChange>( |
| 603 window, ChangeType::DELETE_WINDOW)); | 604 window, ChangeType::DELETE_WINDOW)); |
| 604 tree_->DeleteWindow(change_id, window->server_id()); | 605 tree_->DeleteWindow(change_id, window->server_id()); |
| 605 } | 606 } |
| 606 | 607 |
| 607 windows_.erase(window->server_id()); | 608 windows_.erase(window->server_id()); |
| 608 | 609 |
| 609 for (auto& entry : embedded_windows_) { | 610 for (auto& entry : embedded_windows_) { |
| 610 auto it = entry.second.find(window->GetWindow()); | 611 auto it = entry.second.find(window->GetWindow()); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 WindowMus* window = GetWindowByServerId(window_id); | 1024 WindowMus* window = GetWindowByServerId(window_id); |
| 1024 WindowMus* relative_window = GetWindowByServerId(relative_window_id); | 1025 WindowMus* relative_window = GetWindowByServerId(relative_window_id); |
| 1025 WindowMus* parent = WindowMus::Get(window->GetWindow()->parent()); | 1026 WindowMus* parent = WindowMus::Get(window->GetWindow()->parent()); |
| 1026 if (window && relative_window && parent && | 1027 if (window && relative_window && parent && |
| 1027 parent == WindowMus::Get(relative_window->GetWindow()->parent())) { | 1028 parent == WindowMus::Get(relative_window->GetWindow()->parent())) { |
| 1028 parent->ReorderFromServer(window, relative_window, direction); | 1029 parent->ReorderFromServer(window, relative_window, direction); |
| 1029 } | 1030 } |
| 1030 } | 1031 } |
| 1031 | 1032 |
| 1032 void WindowTreeClient::OnWindowDeleted(Id window_id) { | 1033 void WindowTreeClient::OnWindowDeleted(Id window_id) { |
| 1033 // TODO(sky): decide how best to deal with this. It seems we should let the | 1034 WindowMus* window = GetWindowByServerId(window_id); |
| 1034 // delegate do the actualy deletion. | 1035 if (window) |
| 1035 delete GetWindowByServerId(window_id)->GetWindow(); | 1036 window->DestroyFromServer(); |
| 1036 } | 1037 } |
| 1037 | 1038 |
| 1038 void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) { | 1039 void WindowTreeClient::OnWindowVisibilityChanged(Id window_id, bool visible) { |
| 1039 WindowMus* window = GetWindowByServerId(window_id); | 1040 WindowMus* window = GetWindowByServerId(window_id); |
| 1040 if (!window) | 1041 if (!window) |
| 1041 return; | 1042 return; |
| 1042 | 1043 |
| 1043 InFlightVisibleChange new_change(this, window, visible); | 1044 InFlightVisibleChange new_change(this, window, visible); |
| 1044 if (ApplyServerChangeToExistingInFlightChange(new_change)) | 1045 if (ApplyServerChangeToExistingInFlightChange(new_change)) |
| 1045 return; | 1046 return; |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1558 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1559 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1559 this, capture_synchronizer_.get(), window)); | 1560 this, capture_synchronizer_.get(), window)); |
| 1560 } | 1561 } |
| 1561 | 1562 |
| 1562 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1563 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1563 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1564 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1564 this, focus_synchronizer_.get(), window)); | 1565 this, focus_synchronizer_.get(), window)); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 } // namespace aura | 1568 } // namespace aura |
| OLD | NEW |