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/public/cpp/window_tree_client.h" | 5 #include "services/ui/public/cpp/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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 634 } |
635 | 635 |
636 void WindowTreeClient::StopPointerWatcher() { | 636 void WindowTreeClient::StopPointerWatcher() { |
637 DCHECK(has_pointer_watcher_); | 637 DCHECK(has_pointer_watcher_); |
638 tree_->StopPointerWatcher(); | 638 tree_->StopPointerWatcher(); |
639 has_pointer_watcher_ = false; | 639 has_pointer_watcher_ = false; |
640 } | 640 } |
641 | 641 |
642 void WindowTreeClient::PerformDragDrop( | 642 void WindowTreeClient::PerformDragDrop( |
643 Window* window, | 643 Window* window, |
644 int drag_pointer, | |
645 const std::map<std::string, std::vector<uint8_t>>& drag_data, | 644 const std::map<std::string, std::vector<uint8_t>>& drag_data, |
646 int drag_operation, | 645 int drag_operation, |
647 const gfx::Point& cursor_location, | 646 const gfx::Point& cursor_location, |
648 const SkBitmap& bitmap, | 647 const SkBitmap& bitmap, |
649 const base::Callback<void(bool, uint32_t)>& callback) { | 648 const base::Callback<void(bool, uint32_t)>& callback) { |
650 DCHECK(!current_drag_state_); | 649 DCHECK(!current_drag_state_); |
651 | 650 |
652 // TODO(erg): Pass |cursor_location| and |bitmap| in PerformDragDrop() when | 651 // TODO(erg): Pass |cursor_location| and |bitmap| in PerformDragDrop() when |
653 // we start showing an image representation of the drag under he cursor. | 652 // we start showing an image representation of the drag under he cursor. |
654 | 653 |
655 if (window->drop_target()) { | 654 if (window->drop_target()) { |
656 // To minimize the number of round trips, copy the drag drop data to our | 655 // To minimize the number of round trips, copy the drag drop data to our |
657 // handler here, instead of forcing mus to send this same data back. | 656 // handler here, instead of forcing mus to send this same data back. |
658 OnDragDropStart( | 657 OnDragDropStart( |
659 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data)); | 658 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data)); |
660 } | 659 } |
661 | 660 |
662 uint32_t current_drag_change = ScheduleInFlightChange( | 661 uint32_t current_drag_change = ScheduleInFlightChange( |
663 base::MakeUnique<InFlightDragChange>(window, ChangeType::DRAG_LOOP)); | 662 base::MakeUnique<InFlightDragChange>(window, ChangeType::DRAG_LOOP)); |
664 current_drag_state_.reset(new CurrentDragState{ | 663 current_drag_state_.reset(new CurrentDragState{ |
665 current_drag_change, ui::mojom::kDropEffectNone, callback}); | 664 current_drag_change, ui::mojom::kDropEffectNone, callback}); |
666 | 665 |
667 tree_->PerformDragDrop( | 666 tree_->PerformDragDrop( |
668 current_drag_change, window->server_id(), drag_pointer, | 667 current_drag_change, window->server_id(), |
669 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data), | 668 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(drag_data), |
670 drag_operation); | 669 drag_operation); |
671 } | 670 } |
672 | 671 |
673 void WindowTreeClient::CancelDragDrop(Window* window) { | 672 void WindowTreeClient::CancelDragDrop(Window* window) { |
674 // Server will clean up drag and fail the in-flight change. | 673 // Server will clean up drag and fail the in-flight change. |
675 tree_->CancelDragDrop(window->server_id()); | 674 tree_->CancelDragDrop(window->server_id()); |
676 } | 675 } |
677 | 676 |
678 void WindowTreeClient::PerformWindowMove( | 677 void WindowTreeClient::PerformWindowMove( |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 Window* window, | 1406 Window* window, |
1408 const gfx::Vector2d& offset, | 1407 const gfx::Vector2d& offset, |
1409 const gfx::Insets& hit_area) { | 1408 const gfx::Insets& hit_area) { |
1410 if (window_manager_internal_client_) { | 1409 if (window_manager_internal_client_) { |
1411 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 1410 window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
1412 server_id(window), offset.x(), offset.y(), hit_area); | 1411 server_id(window), offset.x(), offset.y(), hit_area); |
1413 } | 1412 } |
1414 } | 1413 } |
1415 | 1414 |
1416 } // namespace ui | 1415 } // namespace ui |
OLD | NEW |