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 "services/ui/ws/window_tree.h" | 5 #include "services/ui/ws/window_tree.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 pointer_watcher_want_moves_ = false; | 1353 pointer_watcher_want_moves_ = false; |
1354 } | 1354 } |
1355 | 1355 |
1356 void WindowTree::SetWindowBounds( | 1356 void WindowTree::SetWindowBounds( |
1357 uint32_t change_id, | 1357 uint32_t change_id, |
1358 Id window_id, | 1358 Id window_id, |
1359 const gfx::Rect& bounds, | 1359 const gfx::Rect& bounds, |
1360 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { | 1360 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { |
1361 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1361 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
1362 if (window && ShouldRouteToWindowManager(window)) { | 1362 if (window && ShouldRouteToWindowManager(window)) { |
| 1363 DVLOG(3) << "Redirecting request to change bounds for " |
| 1364 << (window ? WindowIdToTransportId(window->id()) : 0) |
| 1365 << " to window manager..."; |
1363 const uint32_t wm_change_id = | 1366 const uint32_t wm_change_id = |
1364 window_server_->GenerateWindowManagerChangeId(this, change_id); | 1367 window_server_->GenerateWindowManagerChangeId(this, change_id); |
1365 // |window_id| may be a client id, use the id from the window to ensure | 1368 // |window_id| may be a client id, use the id from the window to ensure |
1366 // the windowmanager doesn't get an id it doesn't know about. | 1369 // the windowmanager doesn't get an id it doesn't know about. |
1367 WindowManagerDisplayRoot* display_root = | 1370 WindowManagerDisplayRoot* display_root = |
1368 GetWindowManagerDisplayRoot(window); | 1371 GetWindowManagerDisplayRoot(window); |
1369 WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); | 1372 WindowTree* wm_tree = display_root->window_manager_state()->window_tree(); |
1370 wm_tree->window_manager_internal_->WmSetBounds( | 1373 wm_tree->window_manager_internal_->WmSetBounds( |
1371 wm_change_id, wm_tree->ClientWindowIdForWindow(window).id, | 1374 wm_change_id, wm_tree->ClientWindowIdForWindow(window).id, |
1372 std::move(bounds)); | 1375 std::move(bounds)); |
1373 return; | 1376 return; |
1374 } | 1377 } |
1375 | 1378 |
1376 DVLOG(3) << "set window bounds client window_id=" << window_id | 1379 DVLOG(3) << "set window bounds client window_id=" << window_id |
1377 << " global window_id=" | 1380 << " global window_id=" |
1378 << (window ? WindowIdToTransportId(window->id()) : 0) | 1381 << (window ? WindowIdToTransportId(window->id()) : 0) |
1379 << " bounds=" << bounds.ToString(); | 1382 << " bounds=" << bounds.ToString(); |
1380 // Only the owner of the window can change the bounds. | 1383 // Only the owner of the window can change the bounds. |
1381 bool success = window && access_policy_->CanSetWindowBounds(window); | 1384 bool success = window && access_policy_->CanSetWindowBounds(window); |
1382 if (success) { | 1385 if (success) { |
1383 Operation op(this, window_server_, OperationType::SET_WINDOW_BOUNDS); | 1386 Operation op(this, window_server_, OperationType::SET_WINDOW_BOUNDS); |
1384 window->SetBounds(bounds, local_surface_id); | 1387 window->SetBounds(bounds, local_surface_id); |
| 1388 } else { |
| 1389 DVLOG(1) << "Failed to set bounds on window."; |
1385 } | 1390 } |
1386 client()->OnChangeCompleted(change_id, success); | 1391 client()->OnChangeCompleted(change_id, success); |
1387 } | 1392 } |
1388 | 1393 |
1389 void WindowTree::SetWindowVisibility(uint32_t change_id, | 1394 void WindowTree::SetWindowVisibility(uint32_t change_id, |
1390 Id transport_window_id, | 1395 Id transport_window_id, |
1391 bool visible) { | 1396 bool visible) { |
1392 client()->OnChangeCompleted( | 1397 client()->OnChangeCompleted( |
1393 change_id, | 1398 change_id, |
1394 SetWindowVisibility(ClientWindowId(transport_window_id), visible)); | 1399 SetWindowVisibility(ClientWindowId(transport_window_id), visible)); |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2179 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2184 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
2180 effect_bitmask, callback); | 2185 effect_bitmask, callback); |
2181 } | 2186 } |
2182 | 2187 |
2183 void WindowTree::PerformOnDragDropDone() { | 2188 void WindowTree::PerformOnDragDropDone() { |
2184 client()->OnDragDropDone(); | 2189 client()->OnDragDropDone(); |
2185 } | 2190 } |
2186 | 2191 |
2187 } // namespace ws | 2192 } // namespace ws |
2188 } // namespace ui | 2193 } // namespace ui |
OLD | NEW |