| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 namespace { | 104 namespace { |
| 105 | 105 |
| 106 class HostDispatcherWrapper | 106 class HostDispatcherWrapper |
| 107 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy { | 107 : public webkit::ppapi::PluginDelegate::OutOfProcessProxy { |
| 108 public: | 108 public: |
| 109 HostDispatcherWrapper(RenderViewImpl* rv, | 109 HostDispatcherWrapper(RenderViewImpl* rv, |
| 110 webkit::ppapi::PluginModule* module, | 110 webkit::ppapi::PluginModule* module, |
| 111 const ppapi::PpapiPermissions& perms) | 111 const ppapi::PpapiPermissions& perms) |
| 112 : module_(module), | 112 : module_(module), |
| 113 instance_state_(module), | 113 instance_state_(module), |
| 114 host_factory_(rv, perms, &instance_state_) { | 114 host_factory_(rv, perms, &instance_state_), |
| 115 render_view_(rv) { |
| 115 } | 116 } |
| 116 virtual ~HostDispatcherWrapper() {} | 117 virtual ~HostDispatcherWrapper() {} |
| 117 | 118 |
| 118 bool Init(const IPC::ChannelHandle& channel_handle, | 119 bool Init(const IPC::ChannelHandle& channel_handle, |
| 119 PP_GetInterface_Func local_get_interface, | 120 PP_GetInterface_Func local_get_interface, |
| 120 const ppapi::Preferences& preferences, | 121 const ppapi::Preferences& preferences, |
| 121 const ppapi::PpapiPermissions& permissions, | 122 const ppapi::PpapiPermissions& permissions, |
| 122 PepperHungPluginFilter* filter) { | 123 PepperHungPluginFilter* filter) { |
| 123 if (channel_handle.name.empty()) | 124 if (channel_handle.name.empty()) |
| 124 return false; | 125 return false; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 140 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), | 141 if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(), |
| 141 channel_handle, | 142 channel_handle, |
| 142 true, // Client. | 143 true, // Client. |
| 143 preferences)) { | 144 preferences)) { |
| 144 dispatcher_.reset(); | 145 dispatcher_.reset(); |
| 145 dispatcher_delegate_.reset(); | 146 dispatcher_delegate_.reset(); |
| 146 return false; | 147 return false; |
| 147 } | 148 } |
| 148 dispatcher_->channel()->SetRestrictDispatchChannelGroup( | 149 dispatcher_->channel()->SetRestrictDispatchChannelGroup( |
| 149 content::kRendererRestrictDispatchGroup_Pepper); | 150 content::kRendererRestrictDispatchGroup_Pepper); |
| 151 render_view_->PpapiPluginCreated(host_.get()); |
| 150 return true; | 152 return true; |
| 151 } | 153 } |
| 152 | 154 |
| 153 // OutOfProcessProxy implementation. | 155 // OutOfProcessProxy implementation. |
| 154 virtual const void* GetProxiedInterface(const char* name) { | 156 virtual const void* GetProxiedInterface(const char* name) { |
| 155 return dispatcher_->GetProxiedInterface(name); | 157 return dispatcher_->GetProxiedInterface(name); |
| 156 } | 158 } |
| 157 virtual void AddInstance(PP_Instance instance) { | 159 virtual void AddInstance(PP_Instance instance) { |
| 158 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); | 160 ppapi::proxy::HostDispatcher::SetForInstance(instance, dispatcher_.get()); |
| 159 } | 161 } |
| 160 virtual void RemoveInstance(PP_Instance instance) { | 162 virtual void RemoveInstance(PP_Instance instance) { |
| 161 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); | 163 ppapi::proxy::HostDispatcher::RemoveForInstance(instance); |
| 162 } | 164 } |
| 163 | 165 |
| 164 private: | 166 private: |
| 165 webkit::ppapi::PluginModule* module_; | 167 webkit::ppapi::PluginModule* module_; |
| 166 PepperInstanceStateAccessorImpl instance_state_; | 168 PepperInstanceStateAccessorImpl instance_state_; |
| 167 ContentRendererPepperHostFactory host_factory_; | 169 ContentRendererPepperHostFactory host_factory_; |
| 168 | 170 |
| 171 RenderViewImpl* render_view_; |
| 169 scoped_ptr<ppapi::host::PpapiHost> host_; | 172 scoped_ptr<ppapi::host::PpapiHost> host_; |
| 170 | 173 |
| 171 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_; | 174 scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_; |
| 172 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; | 175 scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_; |
| 173 }; | 176 }; |
| 174 | 177 |
| 175 class QuotaCallbackTranslator : public QuotaDispatcher::Callback { | 178 class QuotaCallbackTranslator : public QuotaDispatcher::Callback { |
| 176 public: | 179 public: |
| 177 typedef webkit::ppapi::PluginDelegate::AvailableSpaceCallback PluginCallback; | 180 typedef webkit::ppapi::PluginDelegate::AvailableSpaceCallback PluginCallback; |
| 178 explicit QuotaCallbackTranslator(const PluginCallback& cb) : callback_(cb) {} | 181 explicit QuotaCallbackTranslator(const PluginCallback& cb) : callback_(cb) {} |
| (...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 else | 1753 else |
| 1751 return render_view_->mouse_lock_dispatcher(); | 1754 return render_view_->mouse_lock_dispatcher(); |
| 1752 } | 1755 } |
| 1753 | 1756 |
| 1754 webkit_glue::ClipboardClient* | 1757 webkit_glue::ClipboardClient* |
| 1755 PepperPluginDelegateImpl::CreateClipboardClient() const { | 1758 PepperPluginDelegateImpl::CreateClipboardClient() const { |
| 1756 return new RendererClipboardClient; | 1759 return new RendererClipboardClient; |
| 1757 } | 1760 } |
| 1758 | 1761 |
| 1759 } // namespace content | 1762 } // namespace content |
| OLD | NEW |