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 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 uint32_t change_id, | 1758 uint32_t change_id, |
1759 Id source_window_id, | 1759 Id source_window_id, |
1760 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, | 1760 const std::unordered_map<std::string, std::vector<uint8_t>>& drag_data, |
1761 uint32_t drag_operation) { | 1761 uint32_t drag_operation) { |
1762 ServerWindow* window = GetWindowByClientId(ClientWindowId(source_window_id)); | 1762 ServerWindow* window = GetWindowByClientId(ClientWindowId(source_window_id)); |
1763 bool success = window && access_policy_->CanInitiateDragLoop(window); | 1763 bool success = window && access_policy_->CanInitiateDragLoop(window); |
1764 if (!success || !ShouldRouteToWindowManager(window)) { | 1764 if (!success || !ShouldRouteToWindowManager(window)) { |
1765 // We need to fail this move loop change, otherwise the client will just be | 1765 // We need to fail this move loop change, otherwise the client will just be |
1766 // waiting for |change_id|. | 1766 // waiting for |change_id|. |
1767 DVLOG(1) << "PerformDragDrop failed (access denied)."; | 1767 DVLOG(1) << "PerformDragDrop failed (access denied)."; |
1768 OnChangeCompleted(change_id, false); | 1768 client()->OnPerformDragDropCompleted(change_id, false, |
| 1769 mojom::kDropEffectNone); |
1769 return; | 1770 return; |
1770 } | 1771 } |
1771 | 1772 |
1772 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window); | 1773 WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window); |
1773 if (!display_root) { | 1774 if (!display_root) { |
1774 // The window isn't parented. There's nothing to do. | 1775 // The window isn't parented. There's nothing to do. |
1775 DVLOG(1) << "PerformDragDrop failed (window unparented)."; | 1776 DVLOG(1) << "PerformDragDrop failed (window unparented)."; |
1776 OnChangeCompleted(change_id, false); | 1777 client()->OnPerformDragDropCompleted(change_id, false, |
| 1778 mojom::kDropEffectNone); |
1777 return; | 1779 return; |
1778 } | 1780 } |
1779 | 1781 |
1780 if (window_server_->in_move_loop() || window_server_->in_drag_loop()) { | 1782 if (window_server_->in_move_loop() || window_server_->in_drag_loop()) { |
1781 // Either the window manager is servicing a window drag or we're servicing | 1783 // Either the window manager is servicing a window drag or we're servicing |
1782 // a drag and drop operation. We can't start a second drag. | 1784 // a drag and drop operation. We can't start a second drag. |
1783 DVLOG(1) << "PerformDragDrop failed (already performing a drag)."; | 1785 DVLOG(1) << "PerformDragDrop failed (already performing a drag)."; |
1784 OnChangeCompleted(change_id, false); | 1786 client()->OnPerformDragDropCompleted(change_id, false, |
| 1787 mojom::kDropEffectNone); |
1785 return; | 1788 return; |
1786 } | 1789 } |
1787 | 1790 |
1788 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to | 1791 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to |
1789 // deal with that later. | 1792 // deal with that later. |
1790 | 1793 |
1791 // Here, we need to dramatically change how the mouse pointer works. Once | 1794 // Here, we need to dramatically change how the mouse pointer works. Once |
1792 // we've started a drag drop operation, cursor events don't go to windows as | 1795 // we've started a drag drop operation, cursor events don't go to windows as |
1793 // normal. | 1796 // normal. |
1794 WindowManagerState* wms = display_root->window_manager_state(); | 1797 WindowManagerState* wms = display_root->window_manager_state(); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2176 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2179 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
2177 effect_bitmask, callback); | 2180 effect_bitmask, callback); |
2178 } | 2181 } |
2179 | 2182 |
2180 void WindowTree::PerformOnDragDropDone() { | 2183 void WindowTree::PerformOnDragDropDone() { |
2181 client()->OnDragDropDone(); | 2184 client()->OnDragDropDone(); |
2182 } | 2185 } |
2183 | 2186 |
2184 } // namespace ws | 2187 } // namespace ws |
2185 } // namespace ui | 2188 } // namespace ui |
OLD | NEW |