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/browser_plugin/browser_plugin_guest.h" | 5 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #include "content/common/drag_messages.h" | 35 #include "content/common/drag_messages.h" |
| 36 #include "content/common/host_shared_bitmap_manager.h" | 36 #include "content/common/host_shared_bitmap_manager.h" |
| 37 #include "content/common/input_messages.h" | 37 #include "content/common/input_messages.h" |
| 38 #include "content/common/site_isolation_policy.h" | 38 #include "content/common/site_isolation_policy.h" |
| 39 #include "content/common/text_input_state.h" | 39 #include "content/common/text_input_state.h" |
| 40 #include "content/common/view_messages.h" | 40 #include "content/common/view_messages.h" |
| 41 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
| 42 #include "content/public/browser/browser_plugin_guest_manager.h" | 42 #include "content/public/browser/browser_plugin_guest_manager.h" |
| 43 #include "content/public/browser/content_browser_client.h" | 43 #include "content/public/browser/content_browser_client.h" |
| 44 #include "content/public/browser/guest_host.h" | 44 #include "content/public/browser/guest_host.h" |
| 45 #include "content/public/browser/render_process_host.h" | |
| 45 #include "content/public/browser/render_widget_host_view.h" | 46 #include "content/public/browser/render_widget_host_view.h" |
| 46 #include "content/public/browser/user_metrics.h" | 47 #include "content/public/browser/user_metrics.h" |
| 47 #include "content/public/browser/web_contents_observer.h" | 48 #include "content/public/browser/web_contents_observer.h" |
| 48 #include "content/public/common/browser_plugin_guest_mode.h" | 49 #include "content/public/common/browser_plugin_guest_mode.h" |
| 49 #include "content/public/common/drop_data.h" | 50 #include "content/public/common/drop_data.h" |
| 50 #include "ui/gfx/geometry/size_conversions.h" | 51 #include "ui/gfx/geometry/size_conversions.h" |
| 51 | 52 |
| 52 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) |
| 53 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" | 54 #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" |
| 54 #include "content/common/frame_messages.h" | 55 #include "content/common/frame_messages.h" |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 792 delegate_->DidDetach(); | 793 delegate_->DidDetach(); |
| 793 } | 794 } |
| 794 | 795 |
| 795 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, | 796 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, |
| 796 blink::WebDragStatus drag_status, | 797 blink::WebDragStatus drag_status, |
| 797 const DropData& drop_data, | 798 const DropData& drop_data, |
| 798 blink::WebDragOperationsMask mask, | 799 blink::WebDragOperationsMask mask, |
| 799 const gfx::Point& location) { | 800 const gfx::Point& location) { |
| 800 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); | 801 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); |
| 801 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder(); | 802 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder(); |
| 803 DropData filtered_data(drop_data); | |
| 804 host->FilterDropData(&filtered_data); | |
| 802 switch (drag_status) { | 805 switch (drag_status) { |
| 803 case blink::WebDragStatusEnter: | 806 case blink::WebDragStatusEnter: |
| 804 // Only track the URL being dragged over the guest if the link isn't | 807 host->DragTargetDragEnter(filtered_data, location, location, mask, |
| 805 // coming from the guest. | |
| 806 if (!embedder->DragEnteredGuest(this)) | |
| 807 dragged_url_ = drop_data.url; | |
| 808 host->DragTargetDragEnter(drop_data, location, location, mask, | |
| 809 drop_data.key_modifiers); | 808 drop_data.key_modifiers); |
| 810 break; | 809 break; |
| 811 case blink::WebDragStatusOver: | 810 case blink::WebDragStatusOver: |
| 812 host->DragTargetDragOver(location, location, mask, | 811 host->DragTargetDragOver(location, location, mask, |
| 813 drop_data.key_modifiers); | 812 drop_data.key_modifiers); |
| 814 break; | 813 break; |
| 815 case blink::WebDragStatusLeave: | 814 case blink::WebDragStatusLeave: |
| 816 embedder->DragLeftGuest(this); | 815 embedder->DragLeftGuest(this); |
| 817 host->DragTargetDragLeave(); | 816 host->DragTargetDragLeave(); |
| 818 break; | 817 break; |
| 819 case blink::WebDragStatusDrop: | 818 case blink::WebDragStatusDrop: |
| 820 host->DragTargetDrop(location, location, drop_data.key_modifiers); | 819 // Only track the URL being dragged over the guest if the link isn't |
| 820 // coming from the guest. | |
| 821 if (!embedder->DragEnteredGuest(this)) | |
|
lazyboy
2016/05/31 22:21:22
Hmm, this doesn't seem quite right, at this point
hush (inactive)
2016/06/04 01:41:45
Right. I found link dropping in chrome://chrome-si
| |
| 822 dragged_url_ = drop_data.url; | |
|
lfg
2016/05/31 21:30:42
Do we still need dragged_url_ as a member?
hush (inactive)
2016/06/04 01:41:45
No. I will remove it in the next patch set.
| |
| 823 | |
| 824 host->DragTargetDrop(filtered_data, location, location, | |
| 825 drop_data.key_modifiers); | |
| 821 if (dragged_url_.is_valid()) { | 826 if (dragged_url_.is_valid()) { |
| 822 delegate_->DidDropLink(dragged_url_); | 827 delegate_->DidDropLink(dragged_url_); |
| 823 dragged_url_ = GURL(); | 828 dragged_url_ = GURL(); |
| 824 } | 829 } |
| 825 break; | 830 break; |
| 826 case blink::WebDragStatusUnknown: | 831 case blink::WebDragStatusUnknown: |
| 827 NOTREACHED(); | 832 NOTREACHED(); |
| 828 } | 833 } |
| 829 last_drag_status_ = drag_status; | 834 last_drag_status_ = drag_status; |
| 830 EndSystemDragIfApplicable(); | 835 EndSystemDragIfApplicable(); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1007 range, character_bounds); | 1012 range, character_bounds); |
| 1008 } | 1013 } |
| 1009 #endif | 1014 #endif |
| 1010 | 1015 |
| 1011 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1016 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1012 if (delegate_) | 1017 if (delegate_) |
| 1013 delegate_->SetContextMenuPosition(position); | 1018 delegate_->SetContextMenuPosition(position); |
| 1014 } | 1019 } |
| 1015 | 1020 |
| 1016 } // namespace content | 1021 } // namespace content |
| OLD | NEW |