Chromium Code Reviews| 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 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1459 | 1459 |
| 1460 void WindowTreeClient::WmCancelMoveLoop(uint32_t change_id) { | 1460 void WindowTreeClient::WmCancelMoveLoop(uint32_t change_id) { |
| 1461 if (!window_manager_delegate_ || change_id != current_wm_move_loop_change_) | 1461 if (!window_manager_delegate_ || change_id != current_wm_move_loop_change_) |
| 1462 return; | 1462 return; |
| 1463 | 1463 |
| 1464 WindowMus* window = GetWindowByServerId(current_wm_move_loop_window_id_); | 1464 WindowMus* window = GetWindowByServerId(current_wm_move_loop_window_id_); |
| 1465 if (window) | 1465 if (window) |
| 1466 window_manager_delegate_->OnWmCancelMoveLoop(window->GetWindow()); | 1466 window_manager_delegate_->OnWmCancelMoveLoop(window->GetWindow()); |
| 1467 } | 1467 } |
| 1468 | 1468 |
| 1469 void WindowTreeClient::WmDeactivateWindow(Id window_id) { | |
| 1470 if (!window_manager_delegate_) | |
| 1471 return; | |
| 1472 | |
| 1473 WindowMus* window = GetWindowByServerId(window_id); | |
| 1474 if (!window) { | |
| 1475 DVLOG(1) << "Attempt to deactivate invalid window " << window_id; | |
| 1476 return; | |
| 1477 } | |
| 1478 | |
| 1479 window_manager_delegate_->OnWmDeactivateWindow(window->GetWindow()); | |
|
sky
2017/01/12 00:55:39
It seems like this should early out if window isn'
Elliot Glaysher
2017/01/12 23:20:37
Hoisted the early out check from inside OnWmDeacti
| |
| 1480 } | |
| 1481 | |
| 1469 void WindowTreeClient::OnAccelerator(uint32_t ack_id, | 1482 void WindowTreeClient::OnAccelerator(uint32_t ack_id, |
| 1470 uint32_t accelerator_id, | 1483 uint32_t accelerator_id, |
| 1471 std::unique_ptr<ui::Event> event) { | 1484 std::unique_ptr<ui::Event> event) { |
| 1472 DCHECK(event); | 1485 DCHECK(event); |
| 1473 const ui::mojom::EventResult result = | 1486 const ui::mojom::EventResult result = |
| 1474 window_manager_delegate_->OnAccelerator(accelerator_id, *event.get()); | 1487 window_manager_delegate_->OnAccelerator(accelerator_id, *event.get()); |
| 1475 if (ack_id && window_manager_internal_client_) | 1488 if (ack_id && window_manager_internal_client_) |
| 1476 window_manager_internal_client_->OnAcceleratorAck(ack_id, result); | 1489 window_manager_internal_client_->OnAcceleratorAck(ack_id, result); |
| 1477 } | 1490 } |
| 1478 | 1491 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1579 base::Optional<gfx::Rect> out_rect = base::nullopt; | 1592 base::Optional<gfx::Rect> out_rect = base::nullopt; |
| 1580 if (mask_rect) { | 1593 if (mask_rect) { |
| 1581 out_rect = gfx::ConvertRectToPixel(ScaleFactorForDisplay(window), | 1594 out_rect = gfx::ConvertRectToPixel(ScaleFactorForDisplay(window), |
| 1582 mask_rect.value()); | 1595 mask_rect.value()); |
| 1583 } | 1596 } |
| 1584 | 1597 |
| 1585 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(), | 1598 tree_->SetHitTestMask(WindowMus::Get(window_tree_host->window())->server_id(), |
| 1586 out_rect); | 1599 out_rect); |
| 1587 } | 1600 } |
| 1588 | 1601 |
| 1602 void WindowTreeClient::OnWindowTreeHostDeactivateWindow( | |
| 1603 WindowTreeHostMus* window_tree_host) { | |
| 1604 tree_->DeactivateWindow( | |
| 1605 WindowMus::Get(window_tree_host->window())->server_id()); | |
| 1606 } | |
| 1607 | |
| 1589 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( | 1608 std::unique_ptr<WindowPortMus> WindowTreeClient::CreateWindowPortForTopLevel( |
| 1590 const std::map<std::string, std::vector<uint8_t>>* properties) { | 1609 const std::map<std::string, std::vector<uint8_t>>* properties) { |
| 1591 std::unique_ptr<WindowPortMus> window_port = | 1610 std::unique_ptr<WindowPortMus> window_port = |
| 1592 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL); | 1611 base::MakeUnique<WindowPortMus>(this, WindowMusType::TOP_LEVEL); |
| 1593 roots_.insert(window_port.get()); | 1612 roots_.insert(window_port.get()); |
| 1594 | 1613 |
| 1595 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++)); | 1614 window_port->set_server_id(MakeTransportId(client_id_, next_window_id_++)); |
| 1596 RegisterWindowMus(window_port.get()); | 1615 RegisterWindowMus(window_port.get()); |
| 1597 | 1616 |
| 1598 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; | 1617 std::unordered_map<std::string, std::vector<uint8_t>> transport_properties; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1693 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( | 1712 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( |
| 1694 this, capture_synchronizer_.get(), window)); | 1713 this, capture_synchronizer_.get(), window)); |
| 1695 } | 1714 } |
| 1696 | 1715 |
| 1697 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { | 1716 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { |
| 1698 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( | 1717 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( |
| 1699 this, focus_synchronizer_.get(), window)); | 1718 this, focus_synchronizer_.get(), window)); |
| 1700 } | 1719 } |
| 1701 | 1720 |
| 1702 } // namespace aura | 1721 } // namespace aura |
| OLD | NEW |