OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 | 10 |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 // We were waiting on the status message so we could send the XdndDrop. | 673 // We were waiting on the status message so we could send the XdndDrop. |
674 if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) { | 674 if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) { |
675 move_loop_->EndMoveLoop(); | 675 move_loop_->EndMoveLoop(); |
676 return; | 676 return; |
677 } | 677 } |
678 source_state_ = SOURCE_STATE_DROPPED; | 678 source_state_ = SOURCE_STATE_DROPPED; |
679 SendXdndDrop(source_window); | 679 SendXdndDrop(source_window); |
680 return; | 680 return; |
681 } | 681 } |
682 | 682 |
683 int cursor_type = ui::kCursorNull; | 683 ui::CursorType cursor_type = ui::CursorType::kNull; |
684 switch (negotiated_operation_) { | 684 switch (negotiated_operation_) { |
685 case ui::DragDropTypes::DRAG_NONE: | 685 case ui::DragDropTypes::DRAG_NONE: |
686 cursor_type = ui::kCursorDndNone; | 686 cursor_type = ui::CursorType::kDndNone; |
687 break; | 687 break; |
688 case ui::DragDropTypes::DRAG_MOVE: | 688 case ui::DragDropTypes::DRAG_MOVE: |
689 cursor_type = ui::kCursorDndMove; | 689 cursor_type = ui::CursorType::kDndMove; |
690 break; | 690 break; |
691 case ui::DragDropTypes::DRAG_COPY: | 691 case ui::DragDropTypes::DRAG_COPY: |
692 cursor_type = ui::kCursorDndCopy; | 692 cursor_type = ui::CursorType::kDndCopy; |
693 break; | 693 break; |
694 case ui::DragDropTypes::DRAG_LINK: | 694 case ui::DragDropTypes::DRAG_LINK: |
695 cursor_type = ui::kCursorDndLink; | 695 cursor_type = ui::CursorType::kDndLink; |
696 break; | 696 break; |
697 } | 697 } |
698 move_loop_->UpdateCursor(cursor_manager_->GetInitializedCursor(cursor_type)); | 698 move_loop_->UpdateCursor(cursor_manager_->GetInitializedCursor(cursor_type)); |
699 | 699 |
700 // Note: event.data.[2,3] specify a rectangle. It is a request by the other | 700 // Note: event.data.[2,3] specify a rectangle. It is a request by the other |
701 // window to not send further XdndPosition messages while the cursor is | 701 // window to not send further XdndPosition messages while the cursor is |
702 // within it. However, it is considered advisory and (at least according to | 702 // within it. However, it is considered advisory and (at least according to |
703 // the spec) the other side must handle further position messages within | 703 // the spec) the other side must handle further position messages within |
704 // it. GTK+ doesn't bother with this, so neither should we. | 704 // it. GTK+ doesn't bother with this, so neither should we. |
705 | 705 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 | 842 |
843 // It is possible for the DesktopWindowTreeHostX11 to be destroyed during the | 843 // It is possible for the DesktopWindowTreeHostX11 to be destroyed during the |
844 // move loop, which would also destroy this drag-client. So keep track of | 844 // move loop, which would also destroy this drag-client. So keep track of |
845 // whether it is alive after the drag ends. | 845 // whether it is alive after the drag ends. |
846 base::WeakPtr<DesktopDragDropClientAuraX11> alive( | 846 base::WeakPtr<DesktopDragDropClientAuraX11> alive( |
847 weak_ptr_factory_.GetWeakPtr()); | 847 weak_ptr_factory_.GetWeakPtr()); |
848 | 848 |
849 // Windows has a specific method, DoDragDrop(), which performs the entire | 849 // Windows has a specific method, DoDragDrop(), which performs the entire |
850 // drag. We have to emulate this, so we spin off a nested runloop which will | 850 // drag. We have to emulate this, so we spin off a nested runloop which will |
851 // track all cursor movement and reroute events to a specific handler. | 851 // track all cursor movement and reroute events to a specific handler. |
852 move_loop_->RunMoveLoop( | 852 move_loop_->RunMoveLoop(source_window, cursor_manager_->GetInitializedCursor( |
853 source_window, | 853 ui::CursorType::kGrabbing)); |
854 cursor_manager_->GetInitializedCursor(ui::kCursorGrabbing)); | |
855 | 854 |
856 if (alive) { | 855 if (alive) { |
857 if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) { | 856 if (negotiated_operation_ == ui::DragDropTypes::DRAG_NONE) { |
858 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Cancel", source, | 857 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Cancel", source, |
859 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT); | 858 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT); |
860 } else { | 859 } else { |
861 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Drop", source, | 860 UMA_HISTOGRAM_ENUMERATION("Event.DragDrop.Drop", source, |
862 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT); | 861 ui::DragDropTypes::DRAG_EVENT_SOURCE_COUNT); |
863 } | 862 } |
864 drag_widget_.reset(); | 863 drag_widget_.reset(); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 for (int x = 0; x < in_bitmap->width(); ++x) { | 1361 for (int x = 0; x < in_bitmap->width(); ++x) { |
1363 if (SkColorGetA(in_row[x]) > kMinAlpha) | 1362 if (SkColorGetA(in_row[x]) > kMinAlpha) |
1364 return true; | 1363 return true; |
1365 } | 1364 } |
1366 } | 1365 } |
1367 | 1366 |
1368 return false; | 1367 return false; |
1369 } | 1368 } |
1370 | 1369 |
1371 } // namespace views | 1370 } // namespace views |
OLD | NEW |