Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: content/renderer/pepper/pepper_plugin_delegate_impl.h

Issue 19744007: Create a public API around webkit::ppapi::PluginInstance and use it in chrome. After this, webkit/p… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 19 matching lines...) Expand all
30 class FilePath; 30 class FilePath;
31 } 31 }
32 32
33 namespace ppapi { 33 namespace ppapi {
34 class PepperFilePath; 34 class PepperFilePath;
35 class PPB_X509Certificate_Fields; 35 class PPB_X509Certificate_Fields;
36 } 36 }
37 37
38 namespace webkit { 38 namespace webkit {
39 namespace ppapi { 39 namespace ppapi {
40 class PluginInstance;
41 class PluginModule; 40 class PluginModule;
42 } 41 }
43 } 42 }
44 43
45 namespace WebKit { 44 namespace WebKit {
46 class WebGamepads; 45 class WebGamepads;
47 struct WebCompositionUnderline; 46 struct WebCompositionUnderline;
48 } 47 }
49 48
50 namespace content { 49 namespace content {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); 96 int GetSessionID(PP_DeviceType_Dev type, const std::string& label);
98 97
99 private: 98 private:
100 // RenderViewPepperHelper implementation. 99 // RenderViewPepperHelper implementation.
101 virtual WebKit::WebPlugin* CreatePepperWebPlugin( 100 virtual WebKit::WebPlugin* CreatePepperWebPlugin(
102 const WebPluginInfo& webplugin_info, 101 const WebPluginInfo& webplugin_info,
103 const WebKit::WebPluginParams& params) OVERRIDE; 102 const WebKit::WebPluginParams& params) OVERRIDE;
104 virtual void ViewWillInitiatePaint() OVERRIDE; 103 virtual void ViewWillInitiatePaint() OVERRIDE;
105 virtual void ViewInitiatedPaint() OVERRIDE; 104 virtual void ViewInitiatedPaint() OVERRIDE;
106 virtual void ViewFlushedPaint() OVERRIDE; 105 virtual void ViewFlushedPaint() OVERRIDE;
107 virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint( 106 virtual webkit::ppapi::PluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
108 const gfx::Rect& paint_bounds, 107 const gfx::Rect& paint_bounds,
109 TransportDIB** dib, 108 TransportDIB** dib,
110 gfx::Rect* location, 109 gfx::Rect* location,
111 gfx::Rect* clip, 110 gfx::Rect* clip,
112 float* scale_factor) OVERRIDE; 111 float* scale_factor) OVERRIDE;
113 virtual void OnAsyncFileOpened(base::PlatformFileError error_code, 112 virtual void OnAsyncFileOpened(base::PlatformFileError error_code,
114 base::PlatformFile file, 113 base::PlatformFile file,
115 int message_id) OVERRIDE; 114 int message_id) OVERRIDE;
116 virtual void OnPpapiBrokerChannelCreated( 115 virtual void OnPpapiBrokerChannelCreated(
117 int request_id, 116 int request_id,
(...skipping 12 matching lines...) Expand all
130 ui::Range* range) const OVERRIDE; 129 ui::Range* range) const OVERRIDE;
131 virtual void OnImeSetComposition( 130 virtual void OnImeSetComposition(
132 const string16& text, 131 const string16& text,
133 const std::vector<WebKit::WebCompositionUnderline>& underlines, 132 const std::vector<WebKit::WebCompositionUnderline>& underlines,
134 int selection_start, 133 int selection_start,
135 int selection_end) OVERRIDE; 134 int selection_end) OVERRIDE;
136 virtual void OnImeConfirmComposition(const string16& text) OVERRIDE; 135 virtual void OnImeConfirmComposition(const string16& text) OVERRIDE;
137 virtual void WillHandleMouseEvent() OVERRIDE; 136 virtual void WillHandleMouseEvent() OVERRIDE;
138 137
139 // PluginDelegate implementation. 138 // PluginDelegate implementation.
140 virtual void PluginFocusChanged(webkit::ppapi::PluginInstance* instance, 139 virtual void PluginFocusChanged(webkit::ppapi::PluginInstanceImpl* instance,
141 bool focused) OVERRIDE; 140 bool focused) OVERRIDE;
142 virtual void PluginTextInputTypeChanged( 141 virtual void PluginTextInputTypeChanged(
143 webkit::ppapi::PluginInstance* instance) OVERRIDE; 142 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
144 virtual void PluginCaretPositionChanged( 143 virtual void PluginCaretPositionChanged(
145 webkit::ppapi::PluginInstance* instance) OVERRIDE; 144 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
146 virtual void PluginRequestedCancelComposition( 145 virtual void PluginRequestedCancelComposition(
147 webkit::ppapi::PluginInstance* instance) OVERRIDE; 146 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
148 virtual void PluginSelectionChanged( 147 virtual void PluginSelectionChanged(
149 webkit::ppapi::PluginInstance* instance) OVERRIDE; 148 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
150 virtual void SimulateImeSetComposition( 149 virtual void SimulateImeSetComposition(
151 const string16& text, 150 const string16& text,
152 const std::vector<WebKit::WebCompositionUnderline>& underlines, 151 const std::vector<WebKit::WebCompositionUnderline>& underlines,
153 int selection_start, 152 int selection_start,
154 int selection_end) OVERRIDE; 153 int selection_end) OVERRIDE;
155 virtual void SimulateImeConfirmComposition(const string16& text) OVERRIDE; 154 virtual void SimulateImeConfirmComposition(const string16& text) OVERRIDE;
156 virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance) OVERRIDE; 155 virtual void PluginCrashed(
156 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
157 virtual void InstanceCreated( 157 virtual void InstanceCreated(
158 webkit::ppapi::PluginInstance* instance) OVERRIDE; 158 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
159 virtual void InstanceDeleted( 159 virtual void InstanceDeleted(
160 webkit::ppapi::PluginInstance* instance) OVERRIDE; 160 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
161 virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> 161 virtual scoped_ptr< ::ppapi::thunk::ResourceCreationAPI>
162 CreateResourceCreationAPI( 162 CreateResourceCreationAPI(
163 webkit::ppapi::PluginInstance* instance) OVERRIDE; 163 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
164 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE; 164 virtual SkBitmap* GetSadPluginBitmap() OVERRIDE;
165 virtual WebKit::WebPlugin* CreatePluginReplacement( 165 virtual WebKit::WebPlugin* CreatePluginReplacement(
166 const base::FilePath& file_path) OVERRIDE; 166 const base::FilePath& file_path) OVERRIDE;
167 virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE; 167 virtual uint32_t GetAudioHardwareOutputSampleRate() OVERRIDE;
168 virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE; 168 virtual uint32_t GetAudioHardwareOutputBufferSize() OVERRIDE;
169 virtual PlatformAudioOutput* CreateAudioOutput( 169 virtual PlatformAudioOutput* CreateAudioOutput(
170 uint32_t sample_rate, 170 uint32_t sample_rate,
171 uint32_t sample_count, 171 uint32_t sample_count,
172 PlatformAudioOutputClient* client) OVERRIDE; 172 PlatformAudioOutputClient* client) OVERRIDE;
173 virtual PlatformAudioInput* CreateAudioInput( 173 virtual PlatformAudioInput* CreateAudioInput(
174 const std::string& device_id, 174 const std::string& device_id,
175 const GURL& document_url, 175 const GURL& document_url,
176 uint32_t sample_rate, 176 uint32_t sample_rate,
177 uint32_t sample_count, 177 uint32_t sample_count,
178 PlatformAudioInputClient* client) OVERRIDE; 178 PlatformAudioInputClient* client) OVERRIDE;
179 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE; 179 virtual PlatformImage2D* CreateImage2D(int width, int height) OVERRIDE;
180 virtual PlatformGraphics2D* GetGraphics2D( 180 virtual PlatformGraphics2D* GetGraphics2D(
181 webkit::ppapi::PluginInstance* instance, 181 webkit::ppapi::PluginInstanceImpl* instance,
182 PP_Resource resource) OVERRIDE; 182 PP_Resource resource) OVERRIDE;
183 virtual PlatformContext3D* CreateContext3D() OVERRIDE; 183 virtual PlatformContext3D* CreateContext3D() OVERRIDE;
184 virtual PlatformVideoCapture* CreateVideoCapture( 184 virtual PlatformVideoCapture* CreateVideoCapture(
185 const std::string& device_id, 185 const std::string& device_id,
186 const GURL& document_url, 186 const GURL& document_url,
187 PlatformVideoCaptureEventHandler* handler) OVERRIDE; 187 PlatformVideoCaptureEventHandler* handler) OVERRIDE;
188 virtual PlatformVideoDecoder* CreateVideoDecoder( 188 virtual PlatformVideoDecoder* CreateVideoDecoder(
189 media::VideoDecodeAccelerator::Client* client, 189 media::VideoDecodeAccelerator::Client* client,
190 int32 command_buffer_route_id) OVERRIDE; 190 int32 command_buffer_route_id) OVERRIDE;
191 virtual Broker* ConnectToBroker( 191 virtual Broker* ConnectToBroker(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 uint32 socket_id) OVERRIDE; 288 uint32 socket_id) OVERRIDE;
289 virtual bool AddNetworkListObserver( 289 virtual bool AddNetworkListObserver(
290 webkit_glue::NetworkListObserver* observer) OVERRIDE; 290 webkit_glue::NetworkListObserver* observer) OVERRIDE;
291 virtual void RemoveNetworkListObserver( 291 virtual void RemoveNetworkListObserver(
292 webkit_glue::NetworkListObserver* observer) OVERRIDE; 292 webkit_glue::NetworkListObserver* observer) OVERRIDE;
293 virtual bool X509CertificateParseDER( 293 virtual bool X509CertificateParseDER(
294 const std::vector<char>& der, 294 const std::vector<char>& der,
295 ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE; 295 ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE;
296 virtual webkit::ppapi::FullscreenContainer* 296 virtual webkit::ppapi::FullscreenContainer*
297 CreateFullscreenContainer( 297 CreateFullscreenContainer(
298 webkit::ppapi::PluginInstance* instance) OVERRIDE; 298 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
299 virtual gfx::Size GetScreenSize() OVERRIDE; 299 virtual gfx::Size GetScreenSize() OVERRIDE;
300 virtual std::string GetDefaultEncoding() OVERRIDE; 300 virtual std::string GetDefaultEncoding() OVERRIDE;
301 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor) 301 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor)
302 OVERRIDE; 302 OVERRIDE;
303 virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size) 303 virtual base::SharedMemory* CreateAnonymousSharedMemory(size_t size)
304 OVERRIDE; 304 OVERRIDE;
305 virtual ::ppapi::Preferences GetPreferences() OVERRIDE; 305 virtual ::ppapi::Preferences GetPreferences() OVERRIDE;
306 virtual bool LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; 306 virtual bool LockMouse(webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
307 virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; 307 virtual void UnlockMouse(
308 virtual bool IsMouseLocked(webkit::ppapi::PluginInstance* instance) OVERRIDE; 308 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
309 virtual void DidChangeCursor(webkit::ppapi::PluginInstance* instance, 309 virtual bool IsMouseLocked(
310 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
311 virtual void DidChangeCursor(webkit::ppapi::PluginInstanceImpl* instance,
310 const WebKit::WebCursorInfo& cursor) OVERRIDE; 312 const WebKit::WebCursorInfo& cursor) OVERRIDE;
311 virtual void DidReceiveMouseEvent( 313 virtual void DidReceiveMouseEvent(
312 webkit::ppapi::PluginInstance* instance) OVERRIDE; 314 webkit::ppapi::PluginInstanceImpl* instance) OVERRIDE;
313 virtual bool IsInFullscreenMode() OVERRIDE; 315 virtual bool IsInFullscreenMode() OVERRIDE;
314 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE; 316 virtual void SampleGamepads(WebKit::WebGamepads* data) OVERRIDE;
315 virtual bool IsPageVisible() const OVERRIDE; 317 virtual bool IsPageVisible() const OVERRIDE;
316 virtual int EnumerateDevices( 318 virtual int EnumerateDevices(
317 PP_DeviceType_Dev type, 319 PP_DeviceType_Dev type,
318 const EnumerateDevicesCallback& callback) OVERRIDE; 320 const EnumerateDevicesCallback& callback) OVERRIDE;
319 virtual void StopEnumerateDevices(int request_id) OVERRIDE; 321 virtual void StopEnumerateDevices(int request_id) OVERRIDE;
320 virtual void HandleDocumentLoad( 322 virtual void HandleDocumentLoad(
321 webkit::ppapi::PluginInstance* instance, 323 webkit::ppapi::PluginInstanceImpl* instance,
322 const WebKit::WebURLResponse& response) OVERRIDE; 324 const WebKit::WebURLResponse& response) OVERRIDE;
323 virtual content::RendererPpapiHost* CreateExternalPluginModule( 325 virtual content::RendererPpapiHost* CreateExternalPluginModule(
324 scoped_refptr<webkit::ppapi::PluginModule> module, 326 scoped_refptr<webkit::ppapi::PluginModule> module,
325 const base::FilePath& path, 327 const base::FilePath& path,
326 ::ppapi::PpapiPermissions permissions, 328 ::ppapi::PpapiPermissions permissions,
327 const IPC::ChannelHandle& channel_handle, 329 const IPC::ChannelHandle& channel_handle,
328 base::ProcessId plugin_pid, 330 base::ProcessId plugin_pid,
329 int plugin_child_id) OVERRIDE; 331 int plugin_child_id) OVERRIDE;
330 332
331 // RenderViewObserver implementation. 333 // RenderViewObserver implementation.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 RendererPpapiHost* CreateOutOfProcessModule( 387 RendererPpapiHost* CreateOutOfProcessModule(
386 webkit::ppapi::PluginModule* module, 388 webkit::ppapi::PluginModule* module,
387 const base::FilePath& path, 389 const base::FilePath& path,
388 ppapi::PpapiPermissions permissions, 390 ppapi::PpapiPermissions permissions,
389 const IPC::ChannelHandle& channel_handle, 391 const IPC::ChannelHandle& channel_handle,
390 base::ProcessId plugin_pid, 392 base::ProcessId plugin_pid,
391 int plugin_child_id, 393 int plugin_child_id,
392 bool is_external); 394 bool is_external);
393 395
394 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter( 396 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(
395 webkit::ppapi::PluginInstance* instance); 397 webkit::ppapi::PluginInstanceImpl* instance);
396 void UnSetAndDeleteLockTargetAdapter(webkit::ppapi::PluginInstance* instance); 398 void UnSetAndDeleteLockTargetAdapter(
399 webkit::ppapi::PluginInstanceImpl* instance);
397 400
398 MouseLockDispatcher* GetMouseLockDispatcher( 401 MouseLockDispatcher* GetMouseLockDispatcher(
399 webkit::ppapi::PluginInstance* instance); 402 webkit::ppapi::PluginInstanceImpl* instance);
400 403
401 // Share a given handle with the target process. 404 // Share a given handle with the target process.
402 virtual IPC::PlatformFileForTransit ShareHandleWithRemote( 405 virtual IPC::PlatformFileForTransit ShareHandleWithRemote(
403 base::PlatformFile handle, 406 base::PlatformFile handle,
404 base::ProcessId target_process_id, 407 base::ProcessId target_process_id,
405 bool should_close_source) const OVERRIDE; 408 bool should_close_source) const OVERRIDE;
406 409
407 virtual bool IsRunningInProcess(PP_Instance instance) const OVERRIDE; 410 virtual bool IsRunningInProcess(PP_Instance instance) const OVERRIDE;
408 411
409 // Pointer to the RenderView that owns us. 412 // Pointer to the RenderView that owns us.
410 RenderViewImpl* render_view_; 413 RenderViewImpl* render_view_;
411 414
412 // Connection for sending and receiving pepper host-related messages to/from 415 // Connection for sending and receiving pepper host-related messages to/from
413 // the browser. 416 // the browser.
414 PepperBrowserConnection pepper_browser_connection_; 417 PepperBrowserConnection pepper_browser_connection_;
415 418
416 std::set<webkit::ppapi::PluginInstance*> active_instances_; 419 std::set<webkit::ppapi::PluginInstanceImpl*> active_instances_;
417 typedef std::map<webkit::ppapi::PluginInstance*, 420 typedef std::map<webkit::ppapi::PluginInstanceImpl*,
418 MouseLockDispatcher::LockTarget*> LockTargetMap; 421 MouseLockDispatcher::LockTarget*> LockTargetMap;
419 LockTargetMap mouse_lock_instances_; 422 LockTargetMap mouse_lock_instances_;
420 423
421 IDMap<AsyncOpenFileCallback> pending_async_open_files_; 424 IDMap<AsyncOpenFileCallback> pending_async_open_files_;
422 425
423 IDMap<webkit::ppapi::PPB_TCPSocket_Private_Impl> tcp_sockets_; 426 IDMap<webkit::ppapi::PPB_TCPSocket_Private_Impl> tcp_sockets_;
424 427
425 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_; 428 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_;
426 429
427 typedef IDMap<scoped_refptr<PepperBrokerImpl>, IDMapOwnPointer> BrokerMap; 430 typedef IDMap<scoped_refptr<PepperBrokerImpl>, IDMapOwnPointer> BrokerMap;
428 BrokerMap pending_connect_broker_; 431 BrokerMap pending_connect_broker_;
429 432
430 typedef IDMap<base::WeakPtr<webkit::ppapi::PPB_Broker_Impl> > 433 typedef IDMap<base::WeakPtr<webkit::ppapi::PPB_Broker_Impl> >
431 PermissionRequestMap; 434 PermissionRequestMap;
432 PermissionRequestMap pending_permission_requests_; 435 PermissionRequestMap pending_permission_requests_;
433 436
434 // Whether or not the focus is on a PPAPI plugin 437 // Whether or not the focus is on a PPAPI plugin
435 webkit::ppapi::PluginInstance* focused_plugin_; 438 webkit::ppapi::PluginInstanceImpl* focused_plugin_;
436 439
437 // Current text input composition text. Empty if no composition is in 440 // Current text input composition text. Empty if no composition is in
438 // progress. 441 // progress.
439 string16 composition_text_; 442 string16 composition_text_;
440 443
441 // The plugin instance that received the last mouse event. It is set to NULL 444 // The plugin instance that received the last mouse event. It is set to NULL
442 // if the last mouse event went to elements other than Pepper plugins. 445 // if the last mouse event went to elements other than Pepper plugins.
443 // |last_mouse_event_target_| is not owned by this class. We can know about 446 // |last_mouse_event_target_| is not owned by this class. We can know about
444 // when it is destroyed via InstanceDeleted(). 447 // when it is destroyed via InstanceDeleted().
445 webkit::ppapi::PluginInstance* last_mouse_event_target_; 448 webkit::ppapi::PluginInstanceImpl* last_mouse_event_target_;
446 449
447 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_; 450 scoped_ptr<GamepadSharedMemoryReader> gamepad_shared_memory_reader_;
448 451
449 scoped_ptr<PepperDeviceEnumerationEventHandler> 452 scoped_ptr<PepperDeviceEnumerationEventHandler>
450 device_enumeration_event_handler_; 453 device_enumeration_event_handler_;
451 454
452 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_; 455 scoped_refptr<ContextProviderCommandBuffer> offscreen_context3d_;
453 456
454 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); 457 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl);
455 }; 458 };
456 459
457 } // namespace content 460 } // namespace content
458 461
459 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ 462 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698