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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 795 } |
796 } | 796 } |
797 | 797 |
798 InitInternal(params, embedder_web_contents); | 798 InitInternal(params, embedder_web_contents); |
799 | 799 |
800 attached_ = true; | 800 attached_ = true; |
801 has_attached_since_surface_set_ = true; | 801 has_attached_since_surface_set_ = true; |
802 SendQueuedMessages(); | 802 SendQueuedMessages(); |
803 | 803 |
804 delegate_->DidAttach(GetGuestProxyRoutingID()); | 804 delegate_->DidAttach(GetGuestProxyRoutingID()); |
| 805 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>( |
| 806 web_contents()->GetRenderWidgetHostView()); |
| 807 rwhv->RegisterSurfaceNamespaceId(); |
805 | 808 |
806 if (!use_cross_process_frames) | 809 if (!use_cross_process_frames) |
807 has_render_view_ = true; | 810 has_render_view_ = true; |
808 | 811 |
809 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); | 812 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); |
810 } | 813 } |
811 | 814 |
812 void BrowserPluginGuest::OnCompositorFrameSwappedACK( | 815 void BrowserPluginGuest::OnCompositorFrameSwappedACK( |
813 int browser_plugin_instance_id, | 816 int browser_plugin_instance_id, |
814 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { | 817 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { |
815 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, | 818 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, |
816 params.output_surface_id, | 819 params.output_surface_id, |
817 params.producing_host_id, | 820 params.producing_host_id, |
818 params.ack); | 821 params.ack); |
819 last_pending_frame_.reset(); | 822 last_pending_frame_.reset(); |
820 } | 823 } |
821 | 824 |
822 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { | 825 void BrowserPluginGuest::OnDetach(int browser_plugin_instance_id) { |
823 if (!attached()) | 826 if (!attached()) |
824 return; | 827 return; |
825 | 828 |
826 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until | 829 // This tells BrowserPluginGuest to queue up all IPCs to BrowserPlugin until |
827 // it's attached again. | 830 // it's attached again. |
828 attached_ = false; | 831 attached_ = false; |
829 | 832 |
| 833 RenderWidgetHostViewGuest* rwhv = static_cast<RenderWidgetHostViewGuest*>( |
| 834 web_contents()->GetRenderWidgetHostView()); |
| 835 // If the guest is terminated, our host may already be gone. |
| 836 if (rwhv) |
| 837 rwhv->UnregisterSurfaceNamespaceId(); |
| 838 |
830 delegate_->DidDetach(); | 839 delegate_->DidDetach(); |
831 } | 840 } |
832 | 841 |
833 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, | 842 void BrowserPluginGuest::OnDragStatusUpdate(int browser_plugin_instance_id, |
834 blink::WebDragStatus drag_status, | 843 blink::WebDragStatus drag_status, |
835 const DropData& drop_data, | 844 const DropData& drop_data, |
836 blink::WebDragOperationsMask mask, | 845 blink::WebDragOperationsMask mask, |
837 const gfx::Point& location) { | 846 const gfx::Point& location) { |
838 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); | 847 RenderViewHost* host = GetWebContents()->GetRenderViewHost(); |
839 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder(); | 848 auto embedder = owner_web_contents_->GetBrowserPluginEmbedder(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 range, character_bounds); | 1059 range, character_bounds); |
1051 } | 1060 } |
1052 #endif | 1061 #endif |
1053 | 1062 |
1054 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { | 1063 void BrowserPluginGuest::SetContextMenuPosition(const gfx::Point& position) { |
1055 if (delegate_) | 1064 if (delegate_) |
1056 delegate_->SetContextMenuPosition(position); | 1065 delegate_->SetContextMenuPosition(position); |
1057 } | 1066 } |
1058 | 1067 |
1059 } // namespace content | 1068 } // namespace content |
OLD | NEW |