| 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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 } | 742 } |
| 743 | 743 |
| 744 void BrowserPluginGuest::OnWillAttachComplete( | 744 void BrowserPluginGuest::OnWillAttachComplete( |
| 745 WebContentsImpl* embedder_web_contents, | 745 WebContentsImpl* embedder_web_contents, |
| 746 const BrowserPluginHostMsg_Attach_Params& params) { | 746 const BrowserPluginHostMsg_Attach_Params& params) { |
| 747 bool use_cross_process_frames = | 747 bool use_cross_process_frames = |
| 748 BrowserPluginGuestMode::UseCrossProcessFramesForGuests(); | 748 BrowserPluginGuestMode::UseCrossProcessFramesForGuests(); |
| 749 // If a RenderView has already been created for this new window, then we need | 749 // 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 | 750 // to initialize the browser-side state now so that the RenderFrameHostManager |
| 751 // does not create a new RenderView on navigation. | 751 // does not create a new RenderView on navigation. |
| 752 // TODO(wjmaclean): this pathway doesn't seem to ever get hit when using |
| 753 // cross-process-frames ... should it be removed? Or am I just missing a |
| 754 // use case? |
| 752 if (!use_cross_process_frames && has_render_view_) { | 755 if (!use_cross_process_frames && has_render_view_) { |
| 753 // This will trigger a callback to RenderViewReady after a round-trip IPC. | 756 // This will trigger a callback to RenderViewReady after a round-trip IPC. |
| 754 static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost()) | 757 static_cast<RenderViewHostImpl*>(GetWebContents()->GetRenderViewHost()) |
| 755 ->GetWidget() | 758 ->GetWidget() |
| 756 ->Init(); | 759 ->Init(); |
| 757 GetWebContents()->GetMainFrame()->Init(); | 760 GetWebContents()->GetMainFrame()->Init(); |
| 758 WebContentsViewGuest* web_contents_view = | 761 WebContentsViewGuest* web_contents_view = |
| 759 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); | 762 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); |
| 760 if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { | 763 if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { |
| 761 web_contents_view->CreateViewForWidget( | 764 web_contents_view->CreateViewForWidget( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 781 } | 784 } |
| 782 | 785 |
| 783 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { | 786 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { |
| 784 if (!attached()) | 787 if (!attached()) |
| 785 return; | 788 return; |
| 786 | 789 |
| 787 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until | 790 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until |
| 788 // it's attached again. | 791 // it's attached again. |
| 789 attached_ = false; | 792 attached_ = false; |
| 790 | 793 |
| 791 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>( | 794 RenderWidgetHostViewBase* rwhv = static_cast<RenderWidgetHostViewBase*>( |
| 792 web_contents()->GetRenderWidgetHostView()); | 795 web_contents()->GetRenderWidgetHostView()); |
| 793 // If the guest is terminated, our host may already be gone. | 796 // If the guest is terminated, our host may already be gone. |
| 794 if (rwhv) | 797 if (rwhv) |
| 795 rwhv->UnregisterSurfaceNamespaceId(); | 798 rwhv->UnregisterSurfaceNamespaceId(); |
| 796 | 799 |
| 797 delegate_->DidDetach(); | 800 delegate_->DidDetach(); |
| 798 } | 801 } |
| 799 | 802 |
| 800 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, | 803 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, |
| 801 blink::WebDragStatus drag_status, | 804 blink::WebDragStatus drag_status, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 range, character_bounds); | 1016 range, character_bounds); |
| 1014 } | 1017 } |
| 1015 #endif | 1018 #endif |
| 1016 | 1019 |
| 1017 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1020 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
| 1018 if (delegate_) | 1021 if (delegate_) |
| 1019 delegate_->SetContextMenuPosition(position); | 1022 delegate_->SetContextMenuPosition(position); |
| 1020 } | 1023 } |
| 1021 | 1024 |
| 1022 } // namespace content | 1025 } // namespace content |
| OLD | NEW |