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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/browser/renderer_host/dip_util.h" | 8 #include "content/browser/renderer_host/dip_util.h" |
9 #include "content/browser/renderer_host/render_view_host_factory.h" | 9 #include "content/browser/renderer_host/render_view_host_factory.h" |
10 #include "content/browser/web_contents/interstitial_page_impl.h" | 10 #include "content/browser/web_contents/interstitial_page_impl.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 new WebDragSourceAura(GetNativeView(), web_contents_)); | 454 new WebDragSourceAura(GetNativeView(), web_contents_)); |
455 | 455 |
456 // We need to enable recursive tasks on the message loop so we can get | 456 // We need to enable recursive tasks on the message loop so we can get |
457 // updates while in the system DoDragDrop loop. | 457 // updates while in the system DoDragDrop loop. |
458 int result_op = 0; | 458 int result_op = 0; |
459 { | 459 { |
460 // TODO(sad): Avoid using GetCursorScreenPoint here, since the drag may not | 460 // TODO(sad): Avoid using GetCursorScreenPoint here, since the drag may not |
461 // always start from a mouse-event (e.g. a touch or gesture event could | 461 // always start from a mouse-event (e.g. a touch or gesture event could |
462 // initiate the drag). The location information should be carried over from | 462 // initiate the drag). The location information should be carried over from |
463 // webkit. http://crbug.com/114754 | 463 // webkit. http://crbug.com/114754 |
| 464 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below. |
464 gfx::Point location( | 465 gfx::Point location( |
465 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint()); | 466 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint()); |
466 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 467 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
467 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( | 468 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( |
468 data, root_window, location, ConvertFromWeb(operations)); | 469 data, root_window, GetContentNativeView(), location, |
| 470 ConvertFromWeb(operations), ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); |
469 } | 471 } |
470 | 472 |
471 // Bail out immediately if the contents view window is gone. Note that it is | 473 // Bail out immediately if the contents view window is gone. Note that it is |
472 // not safe to access any class members after system drag-and-drop returns | 474 // not safe to access any class members after system drag-and-drop returns |
473 // since the class instance might be gone. The local variable |drag_source| | 475 // since the class instance might be gone. The local variable |drag_source| |
474 // is still valid and we can check its window property that is set to NULL | 476 // is still valid and we can check its window property that is set to NULL |
475 // when the contents are gone. | 477 // when the contents are gone. |
476 if (!drag_source->window()) | 478 if (!drag_source->window()) |
477 return; | 479 return; |
478 | 480 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 event.location(), | 688 event.location(), |
687 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 689 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
688 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 690 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
689 if (drag_dest_delegate_) | 691 if (drag_dest_delegate_) |
690 drag_dest_delegate_->OnDrop(); | 692 drag_dest_delegate_->OnDrop(); |
691 current_drop_data_.reset(); | 693 current_drop_data_.reset(); |
692 return current_drag_op_; | 694 return current_drag_op_; |
693 } | 695 } |
694 | 696 |
695 } // namespace content | 697 } // namespace content |
OLD | NEW |