| 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/renderer/pepper/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 dispatcher_.reset(); | 143 dispatcher_.reset(); |
| 144 dispatcher_delegate_.reset(); | 144 dispatcher_delegate_.reset(); |
| 145 return false; | 145 return false; |
| 146 } | 146 } |
| 147 dispatcher_->channel()->SetRestrictDispatchChannelGroup( | 147 dispatcher_->channel()->SetRestrictDispatchChannelGroup( |
| 148 kRendererRestrictDispatchGroup_Pepper); | 148 kRendererRestrictDispatchGroup_Pepper); |
| 149 return true; | 149 return true; |
| 150 } | 150 } |
| 151 | 151 |
| 152 // OutOfProcessProxy implementation. | 152 // OutOfProcessProxy implementation. |
| 153 virtual const void* GetProxiedInterface(const char* name) { | 153 virtual const void* GetProxiedInterface(const char* name) OVERRIDE { |
| 154 return dispatcher_->GetProxiedInterface(name); | 154 return dispatcher_->GetProxiedInterface(name); |
| 155 } | 155 } |
| 156 virtual void AddInstance(PP_Instance instance) { | 156 virtual void AddInstance(PP_Instance instance) OVERRIDE { |
| 157 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); | 157 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); |
| 158 | 158 |
| 159 RendererPpapiHostImpl* host = | 159 RendererPpapiHostImpl* host = |
| 160 RendererPpapiHostImpl::GetForPPInstance(instance); | 160 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 161 // TODO(brettw) remove this null check when the old-style pepper-based | 161 // TODO(brettw) remove this null check when the old-style pepper-based |
| 162 // browser tag is removed from this file. Getting this notification should | 162 // browser tag is removed from this file. Getting this notification should |
| 163 // always give us an instance we can find in the map otherwise, but that | 163 // always give us an instance we can find in the map otherwise, but that |
| 164 // isn't true for browser tag support. | 164 // isn't true for browser tag support. |
| 165 if (host) { | 165 if (host) { |
| 166 RenderView* render_view = host->GetRenderViewForInstance(instance); | 166 RenderView* render_view = host->GetRenderViewForInstance(instance); |
| 167 webkit::ppapi::PluginInstance* plugin_instance = | 167 webkit::ppapi::PluginInstance* plugin_instance = |
| 168 host->GetPluginInstance(instance); | 168 host->GetPluginInstance(instance); |
| 169 render_view->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance( | 169 render_view->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance( |
| 170 plugin_child_id_, | 170 plugin_child_id_, |
| 171 instance, | 171 instance, |
| 172 PepperRendererInstanceData( | 172 PepperRendererInstanceData( |
| 173 0, // The render process id will be supplied in the browser. | 173 0, // The render process id will be supplied in the browser. |
| 174 render_view->GetRoutingID(), | 174 render_view->GetRoutingID(), |
| 175 plugin_instance->container()->element().document().url(), | 175 plugin_instance->container()->element().document().url(), |
| 176 plugin_instance->plugin_url()), | 176 plugin_instance->plugin_url()), |
| 177 is_external_)); | 177 is_external_)); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 virtual void RemoveInstance(PP_Instance instance) { | 180 virtual void RemoveInstance(PP_Instance instance) OVERRIDE { |
| 181 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); | 181 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); |
| 182 | 182 |
| 183 RendererPpapiHostImpl* host = | 183 RendererPpapiHostImpl* host = |
| 184 RendererPpapiHostImpl::GetForPPInstance(instance); | 184 RendererPpapiHostImpl::GetForPPInstance(instance); |
| 185 // TODO(brettw) remove null check as described in AddInstance. | 185 // TODO(brettw) remove null check as described in AddInstance. |
| 186 if (host) { | 186 if (host) { |
| 187 RenderView* render_view = host->GetRenderViewForInstance(instance); | 187 RenderView* render_view = host->GetRenderViewForInstance(instance); |
| 188 render_view->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( | 188 render_view->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( |
| 189 plugin_child_id_, | 189 plugin_child_id_, |
| 190 instance, | 190 instance, |
| 191 is_external_)); | 191 is_external_)); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 virtual base::ProcessId GetPeerProcessId() OVERRIDE { |
| 195 return peer_pid_; |
| 196 } |
| 194 | 197 |
| 195 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); } | 198 ppapi::proxy::HostDispatcher* dispatcher() { return dispatcher_.get(); } |
| 196 | 199 |
| 197 private: | 200 private: |
| 198 webkit::ppapi::PluginModule* module_; | 201 webkit::ppapi::PluginModule* module_; |
| 199 | 202 |
| 200 base::ProcessId peer_pid_; | 203 base::ProcessId peer_pid_; |
| 201 | 204 |
| 202 // ID that the browser process uses to idetify the child process for the | 205 // ID that the browser process uses to idetify the child process for the |
| 203 // plugin. This isn't directly useful from our process (the renderer) except | 206 // plugin. This isn't directly useful from our process (the renderer) except |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 return false; | 756 return false; |
| 754 return focused_plugin_->IsPluginAcceptingCompositionEvents(); | 757 return focused_plugin_->IsPluginAcceptingCompositionEvents(); |
| 755 } | 758 } |
| 756 | 759 |
| 757 bool PepperPluginDelegateImpl::CanComposeInline() const { | 760 bool PepperPluginDelegateImpl::CanComposeInline() const { |
| 758 return IsPluginAcceptingCompositionEvents(); | 761 return IsPluginAcceptingCompositionEvents(); |
| 759 } | 762 } |
| 760 | 763 |
| 761 void PepperPluginDelegateImpl::PluginCrashed( | 764 void PepperPluginDelegateImpl::PluginCrashed( |
| 762 webkit::ppapi::PluginInstance* instance) { | 765 webkit::ppapi::PluginInstance* instance) { |
| 763 render_view_->PluginCrashed(instance->module()->path()); | 766 render_view_->PluginCrashed(instance->module()->path(), |
| 767 instance->module()->GetPeerProcessId()); |
| 764 UnSetAndDeleteLockTargetAdapter(instance); | 768 UnSetAndDeleteLockTargetAdapter(instance); |
| 765 } | 769 } |
| 766 | 770 |
| 767 void PepperPluginDelegateImpl::InstanceCreated( | 771 void PepperPluginDelegateImpl::InstanceCreated( |
| 768 webkit::ppapi::PluginInstance* instance) { | 772 webkit::ppapi::PluginInstance* instance) { |
| 769 active_instances_.insert(instance); | 773 active_instances_.insert(instance); |
| 770 | 774 |
| 771 // Set the initial focus. | 775 // Set the initial focus. |
| 772 instance->SetContentAreaFocus(render_view_->has_focus()); | 776 instance->SetContentAreaFocus(render_view_->has_focus()); |
| 773 } | 777 } |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 RenderWidgetFullscreenPepper* container = | 1733 RenderWidgetFullscreenPepper* container = |
| 1730 static_cast<RenderWidgetFullscreenPepper*>( | 1734 static_cast<RenderWidgetFullscreenPepper*>( |
| 1731 instance->fullscreen_container()); | 1735 instance->fullscreen_container()); |
| 1732 return container->mouse_lock_dispatcher(); | 1736 return container->mouse_lock_dispatcher(); |
| 1733 } else { | 1737 } else { |
| 1734 return render_view_->mouse_lock_dispatcher(); | 1738 return render_view_->mouse_lock_dispatcher(); |
| 1735 } | 1739 } |
| 1736 } | 1740 } |
| 1737 | 1741 |
| 1738 } // namespace content | 1742 } // namespace content |
| OLD | NEW |