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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 void WindowTree::GetCursorLocationMemory( | 1498 void WindowTree::GetCursorLocationMemory( |
1499 const GetCursorLocationMemoryCallback& callback) { | 1499 const GetCursorLocationMemoryCallback& callback) { |
1500 callback.Run( | 1500 callback.Run( |
1501 window_server_->display_manager()->GetUserDisplayManager(user_id_)-> | 1501 window_server_->display_manager()->GetUserDisplayManager(user_id_)-> |
1502 GetCursorLocationMemory()); | 1502 GetCursorLocationMemory()); |
1503 } | 1503 } |
1504 | 1504 |
1505 void WindowTree::PerformDragDrop( | 1505 void WindowTree::PerformDragDrop( |
1506 uint32_t change_id, | 1506 uint32_t change_id, |
1507 Id source_window_id, | 1507 Id source_window_id, |
1508 int32_t drag_pointer, | |
1509 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, | 1508 mojo::Map<mojo::String, mojo::Array<uint8_t>> drag_data, |
1510 uint32_t drag_operation) { | 1509 uint32_t drag_operation) { |
1511 ServerWindow* window = GetWindowByClientId(ClientWindowId(source_window_id)); | 1510 ServerWindow* window = GetWindowByClientId(ClientWindowId(source_window_id)); |
1512 bool success = window && access_policy_->CanInitiateDragLoop(window); | 1511 bool success = window && access_policy_->CanInitiateDragLoop(window); |
1513 if (!success || !ShouldRouteToWindowManager(window)) { | 1512 if (!success || !ShouldRouteToWindowManager(window)) { |
1514 // We need to fail this move loop change, otherwise the client will just be | 1513 // We need to fail this move loop change, otherwise the client will just be |
1515 // waiting for |change_id|. | 1514 // waiting for |change_id|. |
1516 DVLOG(1) << "PerformDragDrop failed (access denied)."; | 1515 DVLOG(1) << "PerformDragDrop failed (access denied)."; |
1517 OnChangeCompleted(change_id, false); | 1516 OnChangeCompleted(change_id, false); |
1518 return; | 1517 return; |
(...skipping 16 matching lines...) Expand all Loading... |
1535 } | 1534 } |
1536 | 1535 |
1537 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to | 1536 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to |
1538 // deal with that later. | 1537 // deal with that later. |
1539 | 1538 |
1540 // Here, we need to dramatically change how the mouse pointer works. Once | 1539 // Here, we need to dramatically change how the mouse pointer works. Once |
1541 // we've started a drag drop operation, cursor events don't go to windows as | 1540 // we've started a drag drop operation, cursor events don't go to windows as |
1542 // normal. | 1541 // normal. |
1543 WindowManagerState* wms = display_root->window_manager_state(); | 1542 WindowManagerState* wms = display_root->window_manager_state(); |
1544 window_server_->StartDragLoop(change_id, window, this); | 1543 window_server_->StartDragLoop(change_id, window, this); |
1545 wms->SetDragDropSourceWindow(this, window, this, drag_pointer, | 1544 wms->SetDragDropSourceWindow(this, window, this, std::move(drag_data), |
1546 std::move(drag_data), drag_operation); | 1545 drag_operation); |
1547 } | 1546 } |
1548 | 1547 |
1549 void WindowTree::CancelDragDrop(Id window_id) { | 1548 void WindowTree::CancelDragDrop(Id window_id) { |
1550 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1549 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
1551 if (!window) { | 1550 if (!window) { |
1552 DVLOG(1) << "CancelDragDrop failed (no window)"; | 1551 DVLOG(1) << "CancelDragDrop failed (no window)"; |
1553 return; | 1552 return; |
1554 } | 1553 } |
1555 | 1554 |
1556 if (window != window_server_->GetCurrentDragLoopWindow()) { | 1555 if (window != window_server_->GetCurrentDragLoopWindow()) { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 1906 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
1908 effect_bitmask, callback); | 1907 effect_bitmask, callback); |
1909 } | 1908 } |
1910 | 1909 |
1911 void WindowTree::PerformOnDragDropDone() { | 1910 void WindowTree::PerformOnDragDropDone() { |
1912 client()->OnDragDropDone(); | 1911 client()->OnDragDropDone(); |
1913 } | 1912 } |
1914 | 1913 |
1915 } // namespace ws | 1914 } // namespace ws |
1916 } // namespace ui | 1915 } // namespace ui |
OLD | NEW |