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