| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "mojo/public/cpp/bindings/stl_converters.h" | 14 #include "mojo/public/cpp/bindings/map.h" |
| 15 #include "services/ui/ws/default_access_policy.h" | 15 #include "services/ui/ws/default_access_policy.h" |
| 16 #include "services/ui/ws/display.h" | 16 #include "services/ui/ws/display.h" |
| 17 #include "services/ui/ws/display_manager.h" | 17 #include "services/ui/ws/display_manager.h" |
| 18 #include "services/ui/ws/event_matcher.h" | 18 #include "services/ui/ws/event_matcher.h" |
| 19 #include "services/ui/ws/focus_controller.h" | 19 #include "services/ui/ws/focus_controller.h" |
| 20 #include "services/ui/ws/operation.h" | 20 #include "services/ui/ws/operation.h" |
| 21 #include "services/ui/ws/platform_display.h" | 21 #include "services/ui/ws/platform_display.h" |
| 22 #include "services/ui/ws/server_window.h" | 22 #include "services/ui/ws/server_window.h" |
| 23 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" | 23 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 24 #include "services/ui/ws/server_window_observer.h" | 24 #include "services/ui/ws/server_window_observer.h" |
| (...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to | 1640 // TODO(erg): Dealing with |drag_representation| is hard, so we're going to |
| 1641 // deal with that later. | 1641 // deal with that later. |
| 1642 | 1642 |
| 1643 // Here, we need to dramatically change how the mouse pointer works. Once | 1643 // Here, we need to dramatically change how the mouse pointer works. Once |
| 1644 // we've started a drag drop operation, cursor events don't go to windows as | 1644 // we've started a drag drop operation, cursor events don't go to windows as |
| 1645 // normal. | 1645 // normal. |
| 1646 WindowManagerState* wms = display_root->window_manager_state(); | 1646 WindowManagerState* wms = display_root->window_manager_state(); |
| 1647 window_server_->StartDragLoop(change_id, window, this); | 1647 window_server_->StartDragLoop(change_id, window, this); |
| 1648 wms->SetDragDropSourceWindow( | 1648 wms->SetDragDropSourceWindow(this, window, this, drag_data, drag_operation); |
| 1649 this, window, this, mojo::WrapSTLType(mojo::UnorderedMapToMap(drag_data)), | |
| 1650 drag_operation); | |
| 1651 } | 1649 } |
| 1652 | 1650 |
| 1653 void WindowTree::CancelDragDrop(Id window_id) { | 1651 void WindowTree::CancelDragDrop(Id window_id) { |
| 1654 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); | 1652 ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id)); |
| 1655 if (!window) { | 1653 if (!window) { |
| 1656 DVLOG(1) << "CancelDragDrop failed (no window)"; | 1654 DVLOG(1) << "CancelDragDrop failed (no window)"; |
| 1657 return; | 1655 return; |
| 1658 } | 1656 } |
| 1659 | 1657 |
| 1660 if (window != window_server_->GetCurrentDragLoopWindow()) { | 1658 if (window != window_server_->GetCurrentDragLoopWindow()) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 const ServerWindow* window) { | 1946 const ServerWindow* window) { |
| 1949 if (!window) | 1947 if (!window) |
| 1950 return nullptr; | 1948 return nullptr; |
| 1951 DragTargetConnection* connection = window_server_->GetTreeWithRoot(window); | 1949 DragTargetConnection* connection = window_server_->GetTreeWithRoot(window); |
| 1952 if (connection) | 1950 if (connection) |
| 1953 return connection; | 1951 return connection; |
| 1954 return window_server_->GetTreeWithId(window->id().client_id); | 1952 return window_server_->GetTreeWithId(window->id().client_id); |
| 1955 } | 1953 } |
| 1956 | 1954 |
| 1957 void WindowTree::PerformOnDragDropStart( | 1955 void WindowTree::PerformOnDragDropStart( |
| 1958 mojo::Map<mojo::String, mojo::Array<uint8_t>> mime_data) { | 1956 const std::unordered_map<std::string, std::vector<uint8_t>>& mime_data) { |
| 1959 client()->OnDragDropStart( | 1957 client()->OnDragDropStart(mime_data); |
| 1960 mojo::MapToUnorderedMap(mojo::UnwrapToSTLType(std::move(mime_data)))); | |
| 1961 } | 1958 } |
| 1962 | 1959 |
| 1963 void WindowTree::PerformOnDragEnter( | 1960 void WindowTree::PerformOnDragEnter( |
| 1964 const ServerWindow* window, | 1961 const ServerWindow* window, |
| 1965 uint32_t event_flags, | 1962 uint32_t event_flags, |
| 1966 const gfx::Point& cursor_offset, | 1963 const gfx::Point& cursor_offset, |
| 1967 uint32_t effect_bitmask, | 1964 uint32_t effect_bitmask, |
| 1968 const base::Callback<void(uint32_t)>& callback) { | 1965 const base::Callback<void(uint32_t)>& callback) { |
| 1969 ClientWindowId client_window_id; | 1966 ClientWindowId client_window_id; |
| 1970 if (!IsWindowKnown(window, &client_window_id)) { | 1967 if (!IsWindowKnown(window, &client_window_id)) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2016 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, | 2013 client()->OnCompleteDrop(client_window_id.id, event_flags, cursor_offset, |
| 2017 effect_bitmask, callback); | 2014 effect_bitmask, callback); |
| 2018 } | 2015 } |
| 2019 | 2016 |
| 2020 void WindowTree::PerformOnDragDropDone() { | 2017 void WindowTree::PerformOnDragDropDone() { |
| 2021 client()->OnDragDropDone(); | 2018 client()->OnDragDropDone(); |
| 2022 } | 2019 } |
| 2023 | 2020 |
| 2024 } // namespace ws | 2021 } // namespace ws |
| 2025 } // namespace ui | 2022 } // namespace ui |
| OLD | NEW |