OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <map> | 10 #include <map> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 }; | 76 }; |
77 | 77 |
78 // This object is NOT thread-safe. | 78 // This object is NOT thread-safe. |
79 class PpapiBrokerImpl : public webkit::ppapi::PluginDelegate::PpapiBroker, | 79 class PpapiBrokerImpl : public webkit::ppapi::PluginDelegate::PpapiBroker, |
80 public base::RefCountedThreadSafe<PpapiBrokerImpl>{ | 80 public base::RefCountedThreadSafe<PpapiBrokerImpl>{ |
81 public: | 81 public: |
82 PpapiBrokerImpl(webkit::ppapi::PluginModule* plugin_module, | 82 PpapiBrokerImpl(webkit::ppapi::PluginModule* plugin_module, |
83 PepperPluginDelegateImpl* delegate_); | 83 PepperPluginDelegateImpl* delegate_); |
84 | 84 |
85 // PpapiBroker implementation. | 85 // PpapiBroker implementation. |
86 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client); | 86 virtual void Connect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
87 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client); | 87 virtual void Disconnect(webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
88 | 88 |
89 // Called when the channel to the broker has been established. | 89 // Called when the channel to the broker has been established. |
90 void OnBrokerChannelConnected(base::ProcessHandle broker_process_handle, | 90 void OnBrokerChannelConnected(base::ProcessHandle broker_process_handle, |
91 const IPC::ChannelHandle& channel_handle); | 91 const IPC::ChannelHandle& channel_handle); |
92 | 92 |
93 // Connects the plugin to the broker via a pipe. | 93 // Connects the plugin to the broker via a pipe. |
94 void ConnectPluginToBroker(webkit::ppapi::PPB_Broker_Impl* client); | 94 void ConnectPluginToBroker(webkit::ppapi::PPB_Broker_Impl* client); |
95 | 95 |
96 // Asynchronously sends a pipe to the broker. | 96 // Asynchronously sends a pipe to the broker. |
97 int32_t SendHandleToBroker(PP_Instance instance, | 97 int32_t SendHandleToBroker(PP_Instance instance, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 // PluginDelegate implementation. | 198 // PluginDelegate implementation. |
199 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, | 199 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, |
200 bool focused) OVERRIDE; | 200 bool focused) OVERRIDE; |
201 virtual void PluginTextInputTypeChanged( | 201 virtual void PluginTextInputTypeChanged( |
202 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 202 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
203 virtual void PluginCaretPositionChanged( | 203 virtual void PluginCaretPositionChanged( |
204 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 204 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
205 virtual void PluginRequestedCancelComposition( | 205 virtual void PluginRequestedCancelComposition( |
206 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 206 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
207 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); | 207 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
208 virtual void InstanceCreated( | 208 virtual void InstanceCreated( |
209 webkit::ppapi::PluginInstance* instance); | 209 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
210 virtual void InstanceDeleted( | 210 virtual void InstanceDeleted( |
211 webkit::ppapi::PluginInstance* instance); | 211 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
212 virtual SkBitmap* GetSadPluginBitmap(); | 212 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; |
213 virtual PlatformAudio* CreateAudio( | 213 virtual PlatformAudio* CreateAudio( |
214 uint32_t sample_rate, | 214 uint32_t sample_rate, |
215 uint32_t sample_count, | 215 uint32_t sample_count, |
216 PlatformAudio::Client* client); | 216 PlatformAudio::Client* client) OVERRIDE; |
217 virtual PlatformImage2D* CreateImage2D(int width, int height); | 217 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; |
218 virtual PlatformContext3D* CreateContext3D(); | 218 virtual PlatformContext3D* CreateContext3D() OVERRIDE; |
219 virtual PlatformVideoCapture* CreateVideoCapture( | 219 virtual PlatformVideoCapture* CreateVideoCapture( |
220 media::VideoCapture::EventHandler* handler) OVERRIDE; | 220 media::VideoCapture::EventHandler* handler) OVERRIDE; |
221 virtual PlatformVideoDecoder* CreateVideoDecoder( | 221 virtual PlatformVideoDecoder* CreateVideoDecoder( |
222 media::VideoDecodeAccelerator::Client* client, | 222 media::VideoDecodeAccelerator::Client* client, |
223 int32 command_buffer_route_id); | 223 int32 command_buffer_route_id) OVERRIDE; |
224 virtual PpapiBroker* ConnectToPpapiBroker( | 224 virtual PpapiBroker* ConnectToPpapiBroker( |
225 webkit::ppapi::PPB_Broker_Impl* client); | 225 webkit::ppapi::PPB_Broker_Impl* client) OVERRIDE; |
226 virtual void NumberOfFindResultsChanged(int identifier, | 226 virtual void NumberOfFindResultsChanged(int identifier, |
227 int total, | 227 int total, |
228 bool final_result); | 228 bool final_result) OVERRIDE; |
229 virtual void SelectedFindResultChanged(int identifier, int index); | 229 virtual void SelectedFindResultChanged(int identifier, int index) OVERRIDE; |
230 virtual bool RunFileChooser( | 230 virtual bool RunFileChooser( |
231 const WebKit::WebFileChooserParams& params, | 231 const WebKit::WebFileChooserParams& params, |
232 WebKit::WebFileChooserCompletion* chooser_completion); | 232 WebKit::WebFileChooserCompletion* chooser_completion) OVERRIDE; |
233 virtual bool AsyncOpenFile(const FilePath& path, | 233 virtual bool AsyncOpenFile(const FilePath& path, |
234 int flags, | 234 int flags, |
235 const AsyncOpenFileCallback& callback); | 235 const AsyncOpenFileCallback& callback) OVERRIDE; |
236 virtual bool AsyncOpenFileSystemURL( | 236 virtual bool AsyncOpenFileSystemURL( |
237 const GURL& path, | 237 const GURL& path, |
238 int flags, | 238 int flags, |
239 const AsyncOpenFileCallback& callback) OVERRIDE; | 239 const AsyncOpenFileCallback& callback) OVERRIDE; |
240 virtual bool OpenFileSystem( | 240 virtual bool OpenFileSystem( |
241 const GURL& url, | 241 const GURL& url, |
242 fileapi::FileSystemType type, | 242 fileapi::FileSystemType type, |
243 long long size, | 243 long long size, |
244 fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE; | 244 fileapi::FileSystemCallbackDispatcher* dispatcher) OVERRIDE; |
245 virtual bool MakeDirectory( | 245 virtual bool MakeDirectory( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 private: | 349 private: |
350 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 350 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
351 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( | 351 scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
352 webkit::ppapi::PluginModule* plugin_module); | 352 webkit::ppapi::PluginModule* plugin_module); |
353 | 353 |
354 bool MouseLockedOrPending() const { | 354 bool MouseLockedOrPending() const { |
355 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; | 355 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; |
356 } | 356 } |
357 | 357 |
358 // Implementation of PepperParentContextProvider. | 358 // Implementation of PepperParentContextProvider. |
359 virtual RendererGLContext* GetParentContextForPlatformContext3D(); | 359 virtual RendererGLContext* GetParentContextForPlatformContext3D() OVERRIDE; |
360 | 360 |
361 // Pointer to the RenderView that owns us. | 361 // Pointer to the RenderView that owns us. |
362 RenderViewImpl* render_view_; | 362 RenderViewImpl* render_view_; |
363 | 363 |
364 std::set<webkit::ppapi::PluginInstance*> active_instances_; | 364 std::set<webkit::ppapi::PluginInstance*> active_instances_; |
365 | 365 |
366 // Used to send a single context menu "completion" upon menu close. | 366 // Used to send a single context menu "completion" upon menu close. |
367 bool has_saved_context_menu_action_; | 367 bool has_saved_context_menu_action_; |
368 unsigned saved_context_menu_action_; | 368 unsigned saved_context_menu_action_; |
369 | 369 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 // The plugin instance that received the last mouse event. It is set to NULL | 403 // The plugin instance that received the last mouse event. It is set to NULL |
404 // if the last mouse event went to elements other than Pepper plugins. | 404 // if the last mouse event went to elements other than Pepper plugins. |
405 // |last_mouse_event_target_| is not owned by this class. We can know about | 405 // |last_mouse_event_target_| is not owned by this class. We can know about |
406 // when it is destroyed via InstanceDeleted(). | 406 // when it is destroyed via InstanceDeleted(). |
407 webkit::ppapi::PluginInstance* last_mouse_event_target_; | 407 webkit::ppapi::PluginInstance* last_mouse_event_target_; |
408 | 408 |
409 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 409 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
410 }; | 410 }; |
411 | 411 |
412 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 412 #endif // CONTENT_RENDERER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |