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/host_dispatcher_wrapper.h" | 5 #include "content/renderer/pepper/host_dispatcher_wrapper.h" |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
| 8 #include "content/public/common/origin_util.h" |
8 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" | 9 #include "content/renderer/pepper/pepper_hung_plugin_filter.h" |
9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
10 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" | 11 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h" |
11 #include "content/renderer/pepper/plugin_module.h" | 12 #include "content/renderer/pepper/plugin_module.h" |
12 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 13 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
13 #include "content/renderer/pepper/renderer_restrict_dispatch_group.h" | 14 #include "content/renderer/pepper/renderer_restrict_dispatch_group.h" |
14 #include "content/renderer/render_frame_impl.h" | 15 #include "content/renderer/render_frame_impl.h" |
| 16 #include "third_party/WebKit/public/web/WebDocument.h" |
| 17 #include "third_party/WebKit/public/web/WebElement.h" |
| 18 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
15 | 19 |
16 namespace content { | 20 namespace content { |
17 | 21 |
18 HostDispatcherWrapper::HostDispatcherWrapper( | 22 HostDispatcherWrapper::HostDispatcherWrapper( |
19 PluginModule* module, | 23 PluginModule* module, |
20 base::ProcessId peer_pid, | 24 base::ProcessId peer_pid, |
21 int plugin_child_id, | 25 int plugin_child_id, |
22 const ppapi::PpapiPermissions& perms, | 26 const ppapi::PpapiPermissions& perms, |
23 bool is_external) | 27 bool is_external) |
24 : module_(module), | 28 : module_(module), |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 82 |
79 RendererPpapiHostImpl* host = | 83 RendererPpapiHostImpl* host = |
80 RendererPpapiHostImpl::GetForPPInstance(instance); | 84 RendererPpapiHostImpl::GetForPPInstance(instance); |
81 // TODO(brettw) remove this null check when the old-style pepper-based | 85 // TODO(brettw) remove this null check when the old-style pepper-based |
82 // browser tag is removed from this file. Getting this notification should | 86 // browser tag is removed from this file. Getting this notification should |
83 // always give us an instance we can find in the map otherwise, but that | 87 // always give us an instance we can find in the map otherwise, but that |
84 // isn't true for browser tag support. | 88 // isn't true for browser tag support. |
85 if (host) { | 89 if (host) { |
86 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); | 90 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); |
87 PepperPluginInstance* plugin_instance = host->GetPluginInstance(instance); | 91 PepperPluginInstance* plugin_instance = host->GetPluginInstance(instance); |
| 92 blink::WebString unused; |
| 93 bool is_privileged_context = |
| 94 plugin_instance->GetContainer() |
| 95 ->element() |
| 96 .document() |
| 97 .isPrivilegedContext(unused) && |
| 98 content::IsOriginSecure(plugin_instance->GetPluginURL()); |
88 render_frame->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance( | 99 render_frame->Send(new ViewHostMsg_DidCreateOutOfProcessPepperInstance( |
89 plugin_child_id_, | 100 plugin_child_id_, instance, |
90 instance, | |
91 PepperRendererInstanceData( | 101 PepperRendererInstanceData( |
92 0, // The render process id will be supplied in the browser. | 102 0, // The render process id will be supplied in the browser. |
93 render_frame->GetRoutingID(), | 103 render_frame->GetRoutingID(), host->GetDocumentURL(instance), |
94 host->GetDocumentURL(instance), | 104 plugin_instance->GetPluginURL(), is_privileged_context), |
95 plugin_instance->GetPluginURL()), | |
96 is_external_)); | 105 is_external_)); |
97 } | 106 } |
98 } | 107 } |
99 | 108 |
100 void HostDispatcherWrapper::RemoveInstance(PP_Instance instance) { | 109 void HostDispatcherWrapper::RemoveInstance(PP_Instance instance) { |
101 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); | 110 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); |
102 | 111 |
103 RendererPpapiHostImpl* host = | 112 RendererPpapiHostImpl* host = |
104 RendererPpapiHostImpl::GetForPPInstance(instance); | 113 RendererPpapiHostImpl::GetForPPInstance(instance); |
105 // TODO(brettw) remove null check as described in AddInstance. | 114 // TODO(brettw) remove null check as described in AddInstance. |
106 if (host) { | 115 if (host) { |
107 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); | 116 RenderFrame* render_frame = host->GetRenderFrameForInstance(instance); |
108 if (render_frame) { | 117 if (render_frame) { |
109 render_frame->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( | 118 render_frame->Send(new ViewHostMsg_DidDeleteOutOfProcessPepperInstance( |
110 plugin_child_id_, instance, is_external_)); | 119 plugin_child_id_, instance, is_external_)); |
111 } | 120 } |
112 } | 121 } |
113 } | 122 } |
114 | 123 |
115 } // namespace content | 124 } // namespace content |
OLD | NEW |