Chromium Code Reviews| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 gfx::Point location( | 464 gfx::Point location( |
| 465 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint()); | 465 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint()); |
| 466 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); | 466 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
| 467 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( | 467 result_op = aura::client::GetDragDropClient(root_window)->StartDragAndDrop( |
| 468 data, root_window, location, ConvertFromWeb(operations)); | 468 data, root_window, location, ConvertFromWeb(operations), |
| 469 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); | |
|
sky
2012/11/05 18:13:56
Do we know this is always from a mouse event?
varunjain
2012/11/05 18:25:49
No. In a followup CL, I plan to patch this informa
| |
| 469 } | 470 } |
| 470 | 471 |
| 471 // Bail out immediately if the contents view window is gone. Note that it is | 472 // 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 | 473 // 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| | 474 // 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 | 475 // is still valid and we can check its window property that is set to NULL |
| 475 // when the contents are gone. | 476 // when the contents are gone. |
| 476 if (!drag_source->window()) | 477 if (!drag_source->window()) |
| 477 return; | 478 return; |
| 478 | 479 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 686 event.location(), | 687 event.location(), |
| 687 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 688 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
| 688 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 689 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 689 if (drag_dest_delegate_) | 690 if (drag_dest_delegate_) |
| 690 drag_dest_delegate_->OnDrop(); | 691 drag_dest_delegate_->OnDrop(); |
| 691 current_drop_data_.reset(); | 692 current_drop_data_.reset(); |
| 692 return current_drag_op_; | 693 return current_drag_op_; |
| 693 } | 694 } |
| 694 | 695 |
| 695 } // namespace content | 696 } // namespace content |
| OLD | NEW |