| 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 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 if (!window_manager_delegate_->IsWindowActive(window->GetWindow())) { | 1505 if (!window_manager_delegate_->IsWindowActive(window->GetWindow())) { |
| 1506 DVLOG(1) << "Non-active window requested deactivation."; | 1506 DVLOG(1) << "Non-active window requested deactivation."; |
| 1507 return; | 1507 return; |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 window_manager_delegate_->OnWmDeactivateWindow(window->GetWindow()); | 1510 window_manager_delegate_->OnWmDeactivateWindow(window->GetWindow()); |
| 1511 } | 1511 } |
| 1512 | 1512 |
| 1513 void WindowTreeClient::WmStackAbove(uint32_t wm_change_id, Id above_id, |
| 1514 Id below_id) { |
| 1515 if (!window_manager_delegate_) |
| 1516 return; |
| 1517 |
| 1518 WindowMus* below_mus = GetWindowByServerId(below_id); |
| 1519 if (!below_mus) { |
| 1520 DVLOG(1) << "Attempt to stack at top invalid window " << below_id; |
| 1521 if (window_manager_internal_client_) |
| 1522 window_manager_internal_client_->WmResponse(wm_change_id, false); |
| 1523 return; |
| 1524 } |
| 1525 |
| 1526 WindowMus* above_mus = GetWindowByServerId(above_id); |
| 1527 if (!above_mus) { |
| 1528 DVLOG(1) << "Attempt to stack at top invalid window " << above_id; |
| 1529 if (window_manager_internal_client_) |
| 1530 window_manager_internal_client_->WmResponse(wm_change_id, false); |
| 1531 return; |
| 1532 } |
| 1533 |
| 1534 Window* above = above_mus->GetWindow(); |
| 1535 Window* below = below_mus->GetWindow(); |
| 1536 |
| 1537 if (above->parent() != below->parent()) { |
| 1538 DVLOG(1) << "Windows do not share the same parent"; |
| 1539 if (window_manager_internal_client_) |
| 1540 window_manager_internal_client_->WmResponse(wm_change_id, false); |
| 1541 return; |
| 1542 } |
| 1543 |
| 1544 above->parent()->StackChildAbove(above, below); |
| 1545 |
| 1546 if (window_manager_internal_client_) |
| 1547 window_manager_internal_client_->WmResponse(wm_change_id, true); |
| 1548 } |
| 1549 |
| 1513 void WindowTreeClient::WmStackAtTop(uint32_t wm_change_id, uint32_t window_id) { | 1550 void WindowTreeClient::WmStackAtTop(uint32_t wm_change_id, uint32_t window_id) { |
| 1514 if (!window_manager_delegate_) | 1551 if (!window_manager_delegate_) |
| 1515 return; | 1552 return; |
| 1516 | 1553 |
| 1517 WindowMus* window = GetWindowByServerId(window_id); | 1554 WindowMus* window = GetWindowByServerId(window_id); |
| 1518 if (!window) { | 1555 if (!window) { |
| 1519 DVLOG(1) << "Attempt to stack at top invalid window " << window_id; | 1556 DVLOG(1) << "Attempt to stack at top invalid window " << window_id; |
| 1520 if (window_manager_internal_client_) | 1557 if (window_manager_internal_client_) |
| 1521 window_manager_internal_client_->WmResponse(wm_change_id, false); | 1558 window_manager_internal_client_->WmResponse(wm_change_id, false); |
| 1522 return; | 1559 return; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(), | 1685 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(), |
| 1649 out_rect); | 1686 out_rect); |
| 1650 } | 1687 } |
| 1651 | 1688 |
| 1652 void WindowTreeClient::OnWindowTreeHostDeactivateWindow( | 1689 void WindowTreeClient::OnWindowTreeHostDeactivateWindow( |
| 1653 WindowTreeHostMus* window_tree_host) { | 1690 WindowTreeHostMus* window_tree_host) { |
| 1654 tree_->DeactivateWindow( | 1691 tree_->DeactivateWindow( |
| 1655 WindowMus::Get(window_tree_host->window())->server_id()); | 1692 WindowMus::Get(window_tree_host->window())->server_id()); |
| 1656 } | 1693 } |
| 1657 | 1694 |
| 1695 void WindowTreeClient::OnWindowTreeHostStackAbove( |
| 1696 WindowTreeHostMus* window_tree_host, |
| 1697 Window* window) { |
| 1698 WindowMus* above = WindowMus::Get(window_tree_host->window()); |
| 1699 WindowMus* below = WindowMus::Get(window); |
| 1700 const uint32_t change_id = ScheduleInFlightChange( |
| 1701 base::MakeUnique<CrashInFlightChange>(above, ChangeType::REORDER)); |
| 1702 tree_->StackAbove(change_id, above->server_id(), below->server_id()); |
| 1703 } |
| 1704 |
| 1658 void WindowTreeClient::OnWindowTreeHostStackAtTop( | 1705 void WindowTreeClient::OnWindowTreeHostStackAtTop( |
| 1659 WindowTreeHostMus* window_tree_host) { | 1706 WindowTreeHostMus* window_tree_host) { |
| 1660 WindowMus* window = WindowMus::Get(window_tree_host->window()); | 1707 WindowMus* window = WindowMus::Get(window_tree_host->window()); |
| 1661 const uint32_t change_id = ScheduleInFlightChange( | 1708 const uint32_t change_id = ScheduleInFlightChange( |
| 1662 base::MakeUnique<CrashInFlightChange>(window, ChangeType::REORDER)); | 1709 base::MakeUnique<CrashInFlightChange>(window, ChangeType::REORDER)); |
| 1663 tree_->StackAtTop(change_id, window->server_id()); | 1710 tree_->StackAtTop(change_id, window->server_id()); |
| 1664 } | 1711 } |
| 1665 | 1712 |
| 1666 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( | 1713 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( |
| 1667 const std::map<std::string, std::vector<uint8_t>>* properties) { | 1714 const std::map<std::string, std::vector<uint8_t>>* properties) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1817 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1771 this, capture_synchronizer_.get(), window)); | 1818 this, capture_synchronizer_.get(), window)); |
| 1772 } | 1819 } |
| 1773 | 1820 |
| 1774 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1821 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1775 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1822 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1776 this, focus_synchronizer_.get(), window)); | 1823 this, focus_synchronizer_.get(), window)); |
| 1777 } | 1824 } |
| 1778 | 1825 |
| 1779 } // namespace aura | 1826 } // namespace aura |
| OLD | NEW |