| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/pickle.h" | 13 #include "base/pickle.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "cc/surfaces/surface.h" | 16 #include "cc/surfaces/surface.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 18 #include "content/browser/browser_plugin/browser_plugin_embedder.h" | 18 #include "content/browser/browser_plugin/browser_plugin_embedder.h" |
| 19 #include "content/browser/browser_thread_impl.h" | 19 #include "content/browser/browser_thread_impl.h" |
| 20 #include "content/browser/child_process_security_policy_impl.h" | 20 #include "content/browser/child_process_security_policy_impl.h" |
| 21 #include "content/browser/compositor/surface_utils.h" | 21 #include "content/browser/compositor/surface_utils.h" |
| 22 #include "content/browser/frame_host/render_frame_host_impl.h" | 22 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 23 #include "content/browser/frame_host/render_frame_proxy_host.h" | 23 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 24 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 24 #include "content/browser/frame_host/render_widget_host_view_guest.h" | 25 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
| 25 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 26 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 26 #include "content/browser/renderer_host/render_view_host_impl.h" | 27 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 27 #include "content/browser/renderer_host/render_widget_host_impl.h" | 28 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 29 #include "content/browser/web_contents/web_contents_impl.h" | 30 #include "content/browser/web_contents/web_contents_impl.h" |
| 30 #include "content/browser/web_contents/web_contents_view_guest.h" | 31 #include "content/browser/web_contents/web_contents_view_guest.h" |
| 31 #include "content/common/browser_plugin/browser_plugin_constants.h" | 32 #include "content/common/browser_plugin/browser_plugin_constants.h" |
| 32 #include "content/common/browser_plugin/browser_plugin_messages.h" | 33 #include "content/common/browser_plugin/browser_plugin_messages.h" |
| 33 #include "content/common/content_constants_internal.h" | 34 #include "content/common/content_constants_internal.h" |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 } | 743 } |
| 743 | 744 |
| 744 void BrowserPluginGuest::OnWillAttachComplete( | 745 void BrowserPluginGuest::OnWillAttachComplete( |
| 745 WebContentsImpl* embedder_web_contents, | 746 WebContentsImpl* embedder_web_contents, |
| 746 const BrowserPluginHostMsg_Attach_Params& params) { | 747 const BrowserPluginHostMsg_Attach_Params& params) { |
| 747 bool use_cross_process_frames = | 748 bool use_cross_process_frames = |
| 748 BrowserPluginGuestMode::UseCrossProcessFramesForGuests(); | 749 BrowserPluginGuestMode::UseCrossProcessFramesForGuests(); |
| 749 // If a RenderView has already been created for this new window, then we need | 750 // If a RenderView has already been created for this new window, then we need |
| 750 // to initialize the browser-side state now so that the RenderFrameHostManager | 751 // to initialize the browser-side state now so that the RenderFrameHostManager |
| 751 // does not create a new RenderView on navigation. | 752 // does not create a new RenderView on navigation. |
| 753 // TODO(wjmaclean): this pathway doesn't seem to ever get hit when using |
| 754 // cross-process-frames ... should it be removed? Or am I just missing a |
| 755 // use case? |
| 752 if (!use_cross_process_frames && has_render_view_) { | 756 if (!use_cross_process_frames && has_render_view_) { |
| 753 // This will trigger a callback to RenderViewReady after a round-trip IPC. | 757 // This will trigger a callback to RenderViewReady after a round-trip IPC. |
| 754 static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost()) | 758 static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost()) |
| 755 ->GetWidget() | 759 ->GetWidget() |
| 756 ->Init(); | 760 ->Init(); |
| 757 GetWebContents()->GetMainFrame()->Init(); | 761 GetWebContents()->GetMainFrame()->Init(); |
| 758 WebContentsViewGuest* web_contents_view = | 762 WebContentsViewGuest* web_contents_view = |
| 759 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 763 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
| 760 if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { | 764 if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { |
| 761 web_contents_view->CreateViewForWidget( | 765 web_contents_view->CreateViewForWidget( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 781 } | 785 } |
| 782 | 786 |
| 783 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { | 787 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { |
| 784 if (!attached()) | 788 if (!attached()) |
| 785 return; | 789 return; |
| 786 | 790 |
| 787 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until | 791 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until |
| 788 // it's attached again. | 792 // it's attached again. |
| 789 attached_ = false; | 793 attached_ = false; |
| 790 | 794 |
| 791 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>( | 795 RenderWidgetHostViewChildFrame* rwhv = |
| 792 web_contents()->GetRenderWidgetHostView()); | 796 static_cast<RenderWidgetHostViewChildFrame*>( |
| 797 web_contents()->GetRenderWidgetHostView()); |
| 793 // If the guest is terminated, our host may already be gone. | 798 // If the guest is terminated, our host may already be gone. |
| 794 if (rwhv) | 799 if (rwhv) |
| 795 rwhv->UnregisterSurfaceNamespaceId(); | 800 rwhv->UnregisterSurfaceNamespaceId(); |
| 796 | 801 |
| 797 delegate_->DidDetach(); | 802 delegate_->DidDetach(); |
| 798 } | 803 } |
| 799 | 804 |
| 800 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, | 805 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, |
| 801 blink::WebDragStatus drag_status, | 806 blink::WebDragStatus drag_status, |
| 802 const DropData& drop_data, | 807 const DropData& drop_data, |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 range, character_bounds); | 1015 range, character_bounds); |
| 1011 } | 1016 } |
| 1012 #endif | 1017 #endif |
| 1013 | 1018 |
| 1014 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1019 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1015 if (delegate_) | 1020 if (delegate_) |
| 1016 delegate_->SetContextMenuPosition(position); | 1021 delegate_->SetContextMenuPosition(position); |
| 1017 } | 1022 } |
| 1018 | 1023 |
| 1019 } // namespace content | 1024 } // namespace content |
| OLD | NEW |