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 16 matching lines...) Expand all Loading... |
27 #include "content/common/fileapi/file_system_messages.h" | 27 #include "content/common/fileapi/file_system_messages.h" |
28 #include "content/common/gpu/client/context_provider_command_buffer.h" | 28 #include "content/common/gpu/client/context_provider_command_buffer.h" |
29 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 29 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
30 #include "content/common/pepper_messages.h" | 30 #include "content/common/pepper_messages.h" |
31 #include "content/common/pepper_plugin_registry.h" | 31 #include "content/common/pepper_plugin_registry.h" |
32 #include "content/common/sandbox_util.h" | 32 #include "content/common/sandbox_util.h" |
33 #include "content/common/view_messages.h" | 33 #include "content/common/view_messages.h" |
34 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
35 #include "content/public/common/context_menu_params.h" | 35 #include "content/public/common/context_menu_params.h" |
36 #include "content/public/common/media_stream_request.h" | 36 #include "content/public/common/media_stream_request.h" |
37 #include "content/public/common/referrer.h" | |
38 #include "content/public/common/webplugininfo.h" | 37 #include "content/public/common/webplugininfo.h" |
39 #include "content/public/renderer/content_renderer_client.h" | 38 #include "content/public/renderer/content_renderer_client.h" |
40 #include "content/public/renderer/renderer_restrict_dispatch_group.h" | 39 #include "content/public/renderer/renderer_restrict_dispatch_group.h" |
41 #include "content/renderer/gamepad_shared_memory_reader.h" | 40 #include "content/renderer/gamepad_shared_memory_reader.h" |
42 #include "content/renderer/media/media_stream_dispatcher.h" | 41 #include "content/renderer/media/media_stream_dispatcher.h" |
43 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" | 42 #include "content/renderer/media/pepper_platform_video_decoder_impl.h" |
44 #include "content/renderer/p2p/socket_dispatcher.h" | 43 #include "content/renderer/p2p/socket_dispatcher.h" |
45 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" | 44 #include "content/renderer/pepper/content_renderer_pepper_host_factory.h" |
46 #include "content/renderer/pepper/pepper_broker_impl.h" | 45 #include "content/renderer/pepper/pepper_broker_impl.h" |
47 #include "content/renderer/pepper/pepper_browser_connection.h" | 46 #include "content/renderer/pepper/pepper_browser_connection.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 const WebPluginInfo& webplugin_info, | 349 const WebPluginInfo& webplugin_info, |
351 const WebKit::WebPluginParams& params) { | 350 const WebKit::WebPluginParams& params) { |
352 bool pepper_plugin_was_registered = false; | 351 bool pepper_plugin_was_registered = false; |
353 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 352 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
354 CreatePepperPluginModule(webplugin_info, &pepper_plugin_was_registered)); | 353 CreatePepperPluginModule(webplugin_info, &pepper_plugin_was_registered)); |
355 | 354 |
356 if (pepper_plugin_was_registered) { | 355 if (pepper_plugin_was_registered) { |
357 if (!pepper_module.get()) | 356 if (!pepper_module.get()) |
358 return NULL; | 357 return NULL; |
359 return new webkit::ppapi::WebPluginImpl( | 358 return new webkit::ppapi::WebPluginImpl( |
360 pepper_module.get(), params, AsWeakPtr()); | 359 pepper_module.get(), params, AsWeakPtr(), render_view_->AsWeakPtr()); |
361 } | 360 } |
362 | 361 |
363 return NULL; | 362 return NULL; |
364 } | 363 } |
365 | 364 |
366 scoped_refptr<webkit::ppapi::PluginModule> | 365 scoped_refptr<webkit::ppapi::PluginModule> |
367 PepperPluginDelegateImpl::CreatePepperPluginModule( | 366 PepperPluginDelegateImpl::CreatePepperPluginModule( |
368 const WebPluginInfo& webplugin_info, | 367 const WebPluginInfo& webplugin_info, |
369 bool* pepper_plugin_was_registered) { | 368 bool* pepper_plugin_was_registered) { |
370 *pepper_plugin_was_registered = true; | 369 *pepper_plugin_was_registered = true; |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 return render_view_->webkit_preferences().default_encoding; | 1297 return render_view_->webkit_preferences().default_encoding; |
1299 } | 1298 } |
1300 | 1299 |
1301 void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor, | 1300 void PepperPluginDelegateImpl::ZoomLimitsChanged(double minimum_factor, |
1302 double maximum_factor) { | 1301 double maximum_factor) { |
1303 double minimum_level = WebView::zoomFactorToZoomLevel(minimum_factor); | 1302 double minimum_level = WebView::zoomFactorToZoomLevel(minimum_factor); |
1304 double maximum_level = WebView::zoomFactorToZoomLevel(maximum_factor); | 1303 double maximum_level = WebView::zoomFactorToZoomLevel(maximum_factor); |
1305 render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level); | 1304 render_view_->webview()->zoomLimitsChanged(minimum_level, maximum_level); |
1306 } | 1305 } |
1307 | 1306 |
1308 void PepperPluginDelegateImpl::DidStartLoading() { | |
1309 render_view_->didStartLoading(); | |
1310 } | |
1311 | |
1312 void PepperPluginDelegateImpl::DidStopLoading() { | |
1313 render_view_->didStopLoading(); | |
1314 } | |
1315 | |
1316 void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) { | |
1317 render_view_->Send(new ViewHostMsg_UpdateContentRestrictions( | |
1318 render_view_->routing_id(), restrictions)); | |
1319 } | |
1320 | |
1321 void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) { | |
1322 WebFrame* frame = render_view_->webview()->mainFrame(); | |
1323 Referrer referrer(frame->document().url(), | |
1324 frame->document().referrerPolicy()); | |
1325 render_view_->Send(new ViewHostMsg_SaveURLAs( | |
1326 render_view_->routing_id(), url, referrer)); | |
1327 } | |
1328 | |
1329 void PepperPluginDelegateImpl::HandleDocumentLoad( | 1307 void PepperPluginDelegateImpl::HandleDocumentLoad( |
1330 webkit::ppapi::PluginInstance* instance, | 1308 webkit::ppapi::PluginInstance* instance, |
1331 const WebKit::WebURLResponse& response) { | 1309 const WebKit::WebURLResponse& response) { |
1332 DCHECK(!instance->document_loader()); | 1310 DCHECK(!instance->document_loader()); |
1333 | 1311 |
1334 PP_Instance pp_instance = instance->pp_instance(); | 1312 PP_Instance pp_instance = instance->pp_instance(); |
1335 RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>( | 1313 RendererPpapiHostImpl* host_impl = static_cast<RendererPpapiHostImpl*>( |
1336 instance->module()->GetEmbedderState()); | 1314 instance->module()->GetEmbedderState()); |
1337 | 1315 |
1338 // Create a loader resource host for this load. Note that we have to set | 1316 // Create a loader resource host for this load. Note that we have to set |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 should_close_source); | 1690 should_close_source); |
1713 } | 1691 } |
1714 | 1692 |
1715 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { | 1693 bool PepperPluginDelegateImpl::IsRunningInProcess(PP_Instance instance) const { |
1716 RendererPpapiHostImpl* host = | 1694 RendererPpapiHostImpl* host = |
1717 RendererPpapiHostImpl::GetForPPInstance(instance); | 1695 RendererPpapiHostImpl::GetForPPInstance(instance); |
1718 return host && host->IsRunningInProcess(); | 1696 return host && host->IsRunningInProcess(); |
1719 } | 1697 } |
1720 | 1698 |
1721 } // namespace content | 1699 } // namespace content |
OLD | NEW |