| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), | 138 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), |
| 139 channel_handle, | 139 channel_handle, |
| 140 true, // Client. | 140 true, // Client. |
| 141 preferences)) { | 141 preferences)) { |
| 142 dispatcher_.reset(); | 142 dispatcher_.reset(); |
| 143 dispatcher_delegate_.reset(); | 143 dispatcher_delegate_.reset(); |
| 144 return false; | 144 return false; |
| 145 } | 145 } |
| 146 dispatcher_->channel()->SetRestrictDispatchChannelGroup( | 146 dispatcher_->channel()->SetRestrictDispatchChannelGroup( |
| 147 content::kRendererRestrictDispatchGroup_Pepper); | 147 kRendererRestrictDispatchGroup_Pepper); |
| 148 return true; | 148 return true; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // OutOfProcessProxy implementation. | 151 // OutOfProcessProxy implementation. |
| 152 virtual const void* GetProxiedInterface(const char* name) { | 152 virtual const void* GetProxiedInterface(const char* name) { |
| 153 return dispatcher_->GetProxiedInterface(name); | 153 return dispatcher_->GetProxiedInterface(name); |
| 154 } | 154 } |
| 155 virtual void AddInstance(PP_Instance instance) { | 155 virtual void AddInstance(PP_Instance instance) { |
| 156 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); | 156 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); |
| 157 | 157 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 const webkit::WebPluginInfo& webplugin_info) { | 308 const webkit::WebPluginInfo& webplugin_info) { |
| 309 // First time an in-process plugin was used, make a host for it. | 309 // First time an in-process plugin was used, make a host for it. |
| 310 const PepperPluginInfo* info = | 310 const PepperPluginInfo* info = |
| 311 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); | 311 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
| 312 DCHECK(!info->is_out_of_process); | 312 DCHECK(!info->is_out_of_process); |
| 313 | 313 |
| 314 ppapi::PpapiPermissions perms( | 314 ppapi::PpapiPermissions perms( |
| 315 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( | 315 PepperPluginRegistry::GetInstance()->GetInfoForPlugin( |
| 316 webplugin_info)->permissions); | 316 webplugin_info)->permissions); |
| 317 RendererPpapiHostImpl* host_impl = | 317 RendererPpapiHostImpl* host_impl = |
| 318 content::RendererPpapiHostImpl::CreateOnModuleForInProcess( | 318 RendererPpapiHostImpl::CreateOnModuleForInProcess( |
| 319 module, perms); | 319 module, perms); |
| 320 render_view->PpapiPluginCreated(host_impl); | 320 render_view->PpapiPluginCreated(host_impl); |
| 321 } | 321 } |
| 322 | 322 |
| 323 } // namespace | 323 } // namespace |
| 324 | 324 |
| 325 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) | 325 PepperPluginDelegateImpl::PepperPluginDelegateImpl(RenderViewImpl* render_view) |
| 326 : RenderViewObserver(render_view), | 326 : RenderViewObserver(render_view), |
| 327 render_view_(render_view), | 327 render_view_(render_view), |
| 328 has_saved_context_menu_action_(false), | 328 has_saved_context_menu_action_(false), |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 // We don't call PepperPluginRegistry::AddLiveModule, as this module is | 411 // We don't call PepperPluginRegistry::AddLiveModule, as this module is |
| 412 // managed externally. | 412 // managed externally. |
| 413 return CreateOutOfProcessModule( | 413 return CreateOutOfProcessModule( |
| 414 module, path, permissions, channel_handle, plugin_child_id); | 414 module, path, permissions, channel_handle, plugin_child_id); |
| 415 } | 415 } |
| 416 | 416 |
| 417 scoped_refptr<webkit::ppapi::PluginModule> | 417 scoped_refptr<webkit::ppapi::PluginModule> |
| 418 PepperPluginDelegateImpl::CreateBrowserPluginModule( | 418 PepperPluginDelegateImpl::CreateBrowserPluginModule( |
| 419 const IPC::ChannelHandle& channel_handle, | 419 const IPC::ChannelHandle& channel_handle, |
| 420 int guest_process_id) { | 420 int guest_process_id) { |
| 421 content::old::BrowserPluginRegistry* registry = | 421 old::BrowserPluginRegistry* registry = |
| 422 RenderThreadImpl::current()->browser_plugin_registry(); | 422 RenderThreadImpl::current()->browser_plugin_registry(); |
| 423 scoped_refptr<webkit::ppapi::PluginModule> module = | 423 scoped_refptr<webkit::ppapi::PluginModule> module = |
| 424 registry->GetModule(guest_process_id); | 424 registry->GetModule(guest_process_id); |
| 425 if (module) | 425 if (module) |
| 426 return module; | 426 return module; |
| 427 | 427 |
| 428 ppapi::PpapiPermissions permissions; | 428 ppapi::PpapiPermissions permissions; |
| 429 | 429 |
| 430 FilePath path(kBrowserPluginPath); | 430 FilePath path(kBrowserPluginPath); |
| 431 scoped_refptr<PepperHungPluginFilter> hung_filter( | 431 scoped_refptr<PepperHungPluginFilter> hung_filter( |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 new HostDispatcherWrapper(module, plugin_child_id, permissions)); | 494 new HostDispatcherWrapper(module, plugin_child_id, permissions)); |
| 495 if (!dispatcher->Init( | 495 if (!dispatcher->Init( |
| 496 channel_handle, | 496 channel_handle, |
| 497 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), | 497 webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(), |
| 498 GetPreferences(), | 498 GetPreferences(), |
| 499 permissions, | 499 permissions, |
| 500 hung_filter.get())) | 500 hung_filter.get())) |
| 501 return NULL; | 501 return NULL; |
| 502 | 502 |
| 503 RendererPpapiHostImpl* host_impl = | 503 RendererPpapiHostImpl* host_impl = |
| 504 content::RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( | 504 RendererPpapiHostImpl::CreateOnModuleForOutOfProcess( |
| 505 module, dispatcher->dispatcher(), permissions); | 505 module, dispatcher->dispatcher(), permissions); |
| 506 render_view_->PpapiPluginCreated(host_impl); | 506 render_view_->PpapiPluginCreated(host_impl); |
| 507 | 507 |
| 508 module->InitAsProxied(dispatcher.release()); | 508 module->InitAsProxied(dispatcher.release()); |
| 509 return host_impl; | 509 return host_impl; |
| 510 } | 510 } |
| 511 | 511 |
| 512 void PepperPluginDelegateImpl::OnMenuAction(int request_id, unsigned action) { | 512 void PepperPluginDelegateImpl::OnMenuAction(int request_id, unsigned action) { |
| 513 // Just save the action. | 513 // Just save the action. |
| 514 DCHECK(!has_saved_context_menu_action_); | 514 DCHECK(!has_saved_context_menu_action_); |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 render_view_->DidStopLoadingForPlugin(); | 1489 render_view_->DidStopLoadingForPlugin(); |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) { | 1492 void PepperPluginDelegateImpl::SetContentRestriction(int restrictions) { |
| 1493 render_view_->Send(new ViewHostMsg_UpdateContentRestrictions( | 1493 render_view_->Send(new ViewHostMsg_UpdateContentRestrictions( |
| 1494 render_view_->routing_id(), restrictions)); | 1494 render_view_->routing_id(), restrictions)); |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) { | 1497 void PepperPluginDelegateImpl::SaveURLAs(const GURL& url) { |
| 1498 WebFrame* frame = render_view_->webview()->mainFrame(); | 1498 WebFrame* frame = render_view_->webview()->mainFrame(); |
| 1499 content::Referrer referrer(frame->document().url(), | 1499 Referrer referrer(frame->document().url(), |
| 1500 frame->document().referrerPolicy()); | 1500 frame->document().referrerPolicy()); |
| 1501 render_view_->Send(new ViewHostMsg_SaveURLAs( | 1501 render_view_->Send(new ViewHostMsg_SaveURLAs( |
| 1502 render_view_->routing_id(), url, referrer)); | 1502 render_view_->routing_id(), url, referrer)); |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 double PepperPluginDelegateImpl::GetLocalTimeZoneOffset(base::Time t) { | 1505 double PepperPluginDelegateImpl::GetLocalTimeZoneOffset(base::Time t) { |
| 1506 double result = 0.0; | 1506 double result = 0.0; |
| 1507 render_view_->Send(new PepperMsg_GetLocalTimeZoneOffset( | 1507 render_view_->Send(new PepperMsg_GetLocalTimeZoneOffset( |
| 1508 t, &result)); | 1508 t, &result)); |
| 1509 return result; | 1509 return result; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 else | 1889 else |
| 1890 return render_view_->mouse_lock_dispatcher(); | 1890 return render_view_->mouse_lock_dispatcher(); |
| 1891 } | 1891 } |
| 1892 | 1892 |
| 1893 webkit_glue::ClipboardClient* | 1893 webkit_glue::ClipboardClient* |
| 1894 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1894 PepperPluginDelegateImpl::CreateClipboardClient() const { |
| 1895 return new RendererClipboardClient; | 1895 return new RendererClipboardClient; |
| 1896 } | 1896 } |
| 1897 | 1897 |
| 1898 } // namespace content | 1898 } // namespace content |
| OLD | NEW |