Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Side by Side Diff: ui/aura/mus/window_tree_client.cc

Issue 2652713003: aura-mus: Make StackAtTop() proxy to the window manager. (Closed)
Patch Set: Add explicit bails in WmStackAtTop. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 next_change->SetRevertValueFrom(*change); 1318 next_change->SetRevertValueFrom(*change);
1319 } else if (!success) { 1319 } else if (!success) {
1320 change->Revert(); 1320 change->Revert();
1321 } 1321 }
1322 1322
1323 if (change_id == current_move_loop_change_) { 1323 if (change_id == current_move_loop_change_) {
1324 current_move_loop_change_ = 0; 1324 current_move_loop_change_ = 0;
1325 on_current_move_finished_.Run(success); 1325 on_current_move_finished_.Run(success);
1326 on_current_move_finished_.Reset(); 1326 on_current_move_finished_.Reset();
1327 } 1327 }
1328
1329 // Look for a corresponding window manager change in the
1330 if (window_manager_internal_client_) {
1331 auto it = in_flight_change_map_.find(change_id);
1332 if (it != in_flight_change_map_.end()) {
1333 window_manager_internal_client_->WmResponse(it->second, success);
1334 in_flight_change_map_.erase(it);
1335 }
1336 }
1328 } 1337 }
1329 1338
1330 void WindowTreeClient::GetWindowManager( 1339 void WindowTreeClient::GetWindowManager(
1331 mojo::AssociatedInterfaceRequest<WindowManager> internal) { 1340 mojo::AssociatedInterfaceRequest<WindowManager> internal) {
1332 window_manager_internal_.reset( 1341 window_manager_internal_.reset(
1333 new mojo::AssociatedBinding<ui::mojom::WindowManager>( 1342 new mojo::AssociatedBinding<ui::mojom::WindowManager>(
1334 this, std::move(internal))); 1343 this, std::move(internal)));
1335 } 1344 }
1336 1345
1337 void WindowTreeClient::RequestClose(uint32_t window_id) { 1346 void WindowTreeClient::RequestClose(uint32_t window_id) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 } 1512 }
1504 1513
1505 if (!window_manager_delegate_->IsWindowActive(window->GetWindow())) { 1514 if (!window_manager_delegate_->IsWindowActive(window->GetWindow())) {
1506 DVLOG(1) << "Non-active window requested deactivation."; 1515 DVLOG(1) << "Non-active window requested deactivation.";
1507 return; 1516 return;
1508 } 1517 }
1509 1518
1510 window_manager_delegate_->OnWmDeactivateWindow(window->GetWindow()); 1519 window_manager_delegate_->OnWmDeactivateWindow(window->GetWindow());
1511 } 1520 }
1512 1521
1522 void WindowTreeClient::WmStackAtTop(uint32_t wm_change_id, uint32_t window_id) {
1523 WindowMus* window = GetWindowByServerId(window_id);
sky 2017/01/24 17:18:23 I think you want almost the same logic here as is
1524 if (!window) {
1525 DVLOG(1) << "Attempt to stack at top invalid window " << window_id;
1526 if (window_manager_internal_client_)
1527 window_manager_internal_client_->WmResponse(wm_change_id, false);
1528 return;
1529 }
1530
1531 Window* parent = window->GetWindow()->parent();
1532 WindowMus* relative_window = WindowMus::Get(parent->children().back());
1533 if (relative_window == window) {
1534 DVLOG(3) << "WmStackAtTop ignored (already at top)";
1535 if (window_manager_internal_client_)
1536 window_manager_internal_client_->WmResponse(wm_change_id, true);
1537 return;
1538 }
1539
1540 const uint32_t client_change_id = ScheduleInFlightChange(
1541 base::MakeUnique<CrashInFlightChange>(WindowMus::Get(parent),
1542 ChangeType::REORDER));
1543 in_flight_change_map_.insert(std::make_pair(client_change_id, wm_change_id));
1544 tree_->ReorderWindow(client_change_id,
1545 window->server_id(),
1546 relative_window->server_id(),
1547 ui::mojom::OrderDirection::ABOVE);
1548 }
1549
1513 void WindowTreeClient::OnAccelerator(uint32_t ack_id, 1550 void WindowTreeClient::OnAccelerator(uint32_t ack_id,
1514 uint32_t accelerator_id, 1551 uint32_t accelerator_id,
1515 std::unique_ptr<ui::Event> event) { 1552 std::unique_ptr<ui::Event> event) {
1516 DCHECK(event); 1553 DCHECK(event);
1517 const ui::mojom::EventResult result = 1554 const ui::mojom::EventResult result =
1518 window_manager_delegate_->OnAccelerator(accelerator_id, *event.get()); 1555 window_manager_delegate_->OnAccelerator(accelerator_id, *event.get());
1519 if (ack_id && window_manager_internal_client_) 1556 if (ack_id && window_manager_internal_client_)
1520 window_manager_internal_client_->OnAcceleratorAck(ack_id, result); 1557 window_manager_internal_client_->OnAcceleratorAck(ack_id, result);
1521 } 1558 }
1522 1559
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1788 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1752 this, capture_synchronizer_.get(), window)); 1789 this, capture_synchronizer_.get(), window));
1753 } 1790 }
1754 1791
1755 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1792 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1756 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1793 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1757 this, focus_synchronizer_.get(), window)); 1794 this, focus_synchronizer_.get(), window));
1758 } 1795 }
1759 1796
1760 } // namespace aura 1797 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698