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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
802 switch (drag_status) { | 803 switch (drag_status) { |
803 case blink::WebDragStatusEnter: | 804 case blink::WebDragStatusEnter: |
804 // Only track the URL being dragged over the guest if the link isn't | 805 // Only track the URL being dragged over the guest if the link isn't |
805 // coming from the guest. | 806 // coming from the guest. |
806 if (!embedder->DragEnteredGuest(this)) | 807 if (!embedder->DragEnteredGuest(this)) |
807 dragged_url_ = drop_data.url; | 808 dragged_url_ = drop_data.url; |
808 host->DragTargetDragEnter(drop_data, location, location, mask, | 809 |
| 810 current_drop_data_.reset(new DropData(drop_data)); |
| 811 host->FilterDropData(current_drop_data_.get()); |
| 812 host->DragTargetDragEnter(*current_drop_data_, location, location, mask, |
809 drop_data.key_modifiers); | 813 drop_data.key_modifiers); |
810 break; | 814 break; |
811 case blink::WebDragStatusOver: | 815 case blink::WebDragStatusOver: |
812 host->DragTargetDragOver(location, location, mask, | 816 host->DragTargetDragOver(location, location, mask, |
813 drop_data.key_modifiers); | 817 drop_data.key_modifiers); |
814 break; | 818 break; |
815 case blink::WebDragStatusLeave: | 819 case blink::WebDragStatusLeave: |
816 embedder->DragLeftGuest(this); | 820 embedder->DragLeftGuest(this); |
817 host->DragTargetDragLeave(); | 821 host->DragTargetDragLeave(); |
| 822 current_drop_data_.reset(); |
818 break; | 823 break; |
819 case blink::WebDragStatusDrop: | 824 case blink::WebDragStatusDrop: |
820 host->DragTargetDrop(location, location, drop_data.key_modifiers); | 825 host->DragTargetDrop(*current_drop_data_, location, location, |
| 826 drop_data.key_modifiers); |
821 if (dragged_url_.is_valid()) { | 827 if (dragged_url_.is_valid()) { |
822 delegate_->DidDropLink(dragged_url_); | 828 delegate_->DidDropLink(dragged_url_); |
823 dragged_url_ = GURL(); | 829 dragged_url_ = GURL(); |
824 } | 830 } |
| 831 current_drop_data_.reset(); |
825 break; | 832 break; |
826 case blink::WebDragStatusUnknown: | 833 case blink::WebDragStatusUnknown: |
| 834 current_drop_data_.reset(); |
827 NOTREACHED(); | 835 NOTREACHED(); |
828 } | 836 } |
829 last_drag_status_ = drag_status; | 837 last_drag_status_ = drag_status; |
830 EndSystemDragIfApplicable(); | 838 EndSystemDragIfApplicable(); |
831 } | 839 } |
832 | 840 |
833 void BrowserPluginGuest::OnExecuteEditCommand(int browser_plugin_instance_id, | 841 void BrowserPluginGuest::OnExecuteEditCommand(int browser_plugin_instance_id, |
834 const std::string& name) { | 842 const std::string& name) { |
835 RenderFrameHost* focused_frame = web_contents()->GetFocusedFrame(); | 843 RenderFrameHost* focused_frame = web_contents()->GetFocusedFrame(); |
836 if (!focused_frame) | 844 if (!focused_frame) |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 range, character_bounds); | 1014 range, character_bounds); |
1007 } | 1015 } |
1008 #endif | 1016 #endif |
1009 | 1017 |
1010 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1018 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1011 if (delegate_) | 1019 if (delegate_) |
1012 delegate_->SetContextMenuPosition(position); | 1020 delegate_->SetContextMenuPosition(position); |
1013 } | 1021 } |
1014 | 1022 |
1015 } // namespace content | 1023 } // namespace content |
OLD | NEW |