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 #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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/id_map.h" | 14 #include "base/id_map.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/public/renderer/context_menu_client.h" |
20 #include "content/public/renderer/render_view_observer.h" | 21 #include "content/public/renderer/render_view_observer.h" |
21 #include "content/renderer/mouse_lock_dispatcher.h" | 22 #include "content/renderer/mouse_lock_dispatcher.h" |
22 #include "content/renderer/pepper/pepper_parent_context_provider.h" | 23 #include "content/renderer/pepper/pepper_parent_context_provider.h" |
23 #include "ppapi/shared_impl/private/ppb_host_resolver_shared.h" | 24 #include "ppapi/shared_impl/private/ppb_host_resolver_shared.h" |
24 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h" | 25 #include "ppapi/shared_impl/private/ppb_tcp_server_socket_shared.h" |
25 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" | 26 #include "ppapi/shared_impl/private/tcp_socket_private_impl.h" |
26 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" | 27 #include "ppapi/shared_impl/private/udp_socket_private_impl.h" |
27 #include "ui/base/ime/text_input_type.h" | 28 #include "ui/base/ime/text_input_type.h" |
28 #include "webkit/plugins/ppapi/plugin_delegate.h" | 29 #include "webkit/plugins/ppapi/plugin_delegate.h" |
29 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 30 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
(...skipping 29 matching lines...) Expand all Loading... |
59 } | 60 } |
60 | 61 |
61 namespace WebKit { | 62 namespace WebKit { |
62 class WebGamepads; | 63 class WebGamepads; |
63 class WebMouseEvent; | 64 class WebMouseEvent; |
64 struct WebCompositionUnderline; | 65 struct WebCompositionUnderline; |
65 } | 66 } |
66 | 67 |
67 namespace content { | 68 namespace content { |
68 | 69 |
69 struct CustomContextMenuContext; | |
70 class GamepadSharedMemoryReader; | 70 class GamepadSharedMemoryReader; |
71 class PepperBrokerImpl; | 71 class PepperBrokerImpl; |
72 class PepperDeviceEnumerationEventHandler; | 72 class PepperDeviceEnumerationEventHandler; |
73 class PepperPluginDelegateImpl; | 73 class PepperPluginDelegateImpl; |
74 | 74 |
75 class PepperPluginDelegateImpl | 75 class PepperPluginDelegateImpl |
76 : public webkit::ppapi::PluginDelegate, | 76 : public webkit::ppapi::PluginDelegate, |
77 public base::SupportsWeakPtr<PepperPluginDelegateImpl>, | 77 public base::SupportsWeakPtr<PepperPluginDelegateImpl>, |
78 public PepperParentContextProvider, | 78 public PepperParentContextProvider, |
79 public RenderViewObserver { | 79 public RenderViewObserver, |
| 80 public ContextMenuClient { |
80 public: | 81 public: |
81 explicit PepperPluginDelegateImpl(RenderViewImpl* render_view); | 82 explicit PepperPluginDelegateImpl(RenderViewImpl* render_view); |
82 virtual ~PepperPluginDelegateImpl(); | 83 virtual ~PepperPluginDelegateImpl(); |
83 | 84 |
84 RenderViewImpl* render_view() { return render_view_; } | 85 RenderViewImpl* render_view() { return render_view_; } |
85 | 86 |
86 // Attempts to create a PPAPI plugin for the given filepath. On success, it | 87 // Attempts to create a PPAPI plugin for the given filepath. On success, it |
87 // will return the newly-created module. | 88 // will return the newly-created module. |
88 // | 89 // |
89 // There are two reasons for failure. The first is that the plugin isn't | 90 // There are two reasons for failure. The first is that the plugin isn't |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 webkit_glue::NetworkListObserver* observer) OVERRIDE; | 347 webkit_glue::NetworkListObserver* observer) OVERRIDE; |
347 | 348 |
348 virtual bool X509CertificateParseDER( | 349 virtual bool X509CertificateParseDER( |
349 const std::vector<char>& der, | 350 const std::vector<char>& der, |
350 ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE; | 351 ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE; |
351 | 352 |
352 virtual int32_t ShowContextMenu( | 353 virtual int32_t ShowContextMenu( |
353 webkit::ppapi::PluginInstance* instance, | 354 webkit::ppapi::PluginInstance* instance, |
354 webkit::ppapi::PPB_Flash_Menu_Impl* menu, | 355 webkit::ppapi::PPB_Flash_Menu_Impl* menu, |
355 const gfx::Point& position) OVERRIDE; | 356 const gfx::Point& position) OVERRIDE; |
356 void OnContextMenuClosed( | |
357 const CustomContextMenuContext& custom_context); | |
358 void OnCustomContextMenuAction( | |
359 const CustomContextMenuContext& custom_context, | |
360 unsigned action); | |
361 void CompleteShowContextMenu(int request_id, | |
362 bool did_select, | |
363 unsigned action); | |
364 virtual webkit::ppapi::FullscreenContainer* | 357 virtual webkit::ppapi::FullscreenContainer* |
365 CreateFullscreenContainer( | 358 CreateFullscreenContainer( |
366 webkit::ppapi::PluginInstance* instance) OVERRIDE; | 359 webkit::ppapi::PluginInstance* instance) OVERRIDE; |
367 virtual gfx::Size GetScreenSize() OVERRIDE; | 360 virtual gfx::Size GetScreenSize() OVERRIDE; |
368 virtual std::string GetDefaultEncoding() OVERRIDE; | 361 virtual std::string GetDefaultEncoding() OVERRIDE; |
369 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor) | 362 virtual void ZoomLimitsChanged(double minimum_factor, double maximum_factor) |
370 OVERRIDE; | 363 OVERRIDE; |
371 virtual std::string ResolveProxy(const GURL& url) OVERRIDE; | 364 virtual std::string ResolveProxy(const GURL& url) OVERRIDE; |
372 virtual void DidStartLoading() OVERRIDE; | 365 virtual void DidStartLoading() OVERRIDE; |
373 virtual void DidStopLoading() OVERRIDE; | 366 virtual void DidStopLoading() OVERRIDE; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 const OpenDeviceCallback& callback); | 457 const OpenDeviceCallback& callback); |
465 void CloseDevice(const std::string& label); | 458 void CloseDevice(const std::string& label); |
466 // Gets audio/video session ID given a label. | 459 // Gets audio/video session ID given a label. |
467 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); | 460 int GetSessionID(PP_DeviceType_Dev type, const std::string& label); |
468 | 461 |
469 private: | 462 private: |
470 // Asynchronously attempts to create a PPAPI broker for the given plugin. | 463 // Asynchronously attempts to create a PPAPI broker for the given plugin. |
471 scoped_refptr<PepperBrokerImpl> CreateBroker( | 464 scoped_refptr<PepperBrokerImpl> CreateBroker( |
472 webkit::ppapi::PluginModule* plugin_module); | 465 webkit::ppapi::PluginModule* plugin_module); |
473 | 466 |
| 467 // ContextMenuClient implementation. |
| 468 virtual void OnMenuAction(int request_id, unsigned action) OVERRIDE; |
| 469 virtual void OnMenuClosed(int request_id) OVERRIDE; |
| 470 |
474 // Implementation of PepperParentContextProvider. | 471 // Implementation of PepperParentContextProvider. |
475 virtual WebGraphicsContext3DCommandBufferImpl* | 472 virtual WebGraphicsContext3DCommandBufferImpl* |
476 GetParentContextForPlatformContext3D() OVERRIDE; | 473 GetParentContextForPlatformContext3D() OVERRIDE; |
477 | 474 |
478 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter( | 475 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter( |
479 webkit::ppapi::PluginInstance* instance); | 476 webkit::ppapi::PluginInstance* instance); |
480 void UnSetAndDeleteLockTargetAdapter(webkit::ppapi::PluginInstance* instance); | 477 void UnSetAndDeleteLockTargetAdapter(webkit::ppapi::PluginInstance* instance); |
481 | 478 |
482 MouseLockDispatcher* GetMouseLockDispatcher( | 479 MouseLockDispatcher* GetMouseLockDispatcher( |
483 webkit::ppapi::PluginInstance* instance); | 480 webkit::ppapi::PluginInstance* instance); |
(...skipping 13 matching lines...) Expand all Loading... |
497 IDMap<AsyncOpenFileCallback> pending_async_open_files_; | 494 IDMap<AsyncOpenFileCallback> pending_async_open_files_; |
498 | 495 |
499 IDMap<webkit::ppapi::PPB_TCPSocket_Private_Impl> tcp_sockets_; | 496 IDMap<webkit::ppapi::PPB_TCPSocket_Private_Impl> tcp_sockets_; |
500 | 497 |
501 IDMap<webkit::ppapi::PPB_UDPSocket_Private_Impl> udp_sockets_; | 498 IDMap<webkit::ppapi::PPB_UDPSocket_Private_Impl> udp_sockets_; |
502 | 499 |
503 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_; | 500 IDMap<ppapi::PPB_TCPServerSocket_Shared> tcp_server_sockets_; |
504 | 501 |
505 IDMap<ppapi::PPB_HostResolver_Shared> host_resolvers_; | 502 IDMap<ppapi::PPB_HostResolver_Shared> host_resolvers_; |
506 | 503 |
507 IDMap<scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl>, | 504 // Maps context menu request IDs to the menu resource to receive the result. |
508 IDMapOwnPointer> pending_context_menus_; | 505 typedef std::map<int, scoped_refptr<webkit::ppapi::PPB_Flash_Menu_Impl> > |
| 506 PendingContextMenuMap; |
| 507 PendingContextMenuMap pending_context_menus_; |
509 | 508 |
510 typedef IDMap<scoped_refptr<PepperBrokerImpl>, IDMapOwnPointer> BrokerMap; | 509 typedef IDMap<scoped_refptr<PepperBrokerImpl>, IDMapOwnPointer> BrokerMap; |
511 BrokerMap pending_connect_broker_; | 510 BrokerMap pending_connect_broker_; |
512 | 511 |
513 typedef IDMap<base::WeakPtr<webkit::ppapi::PPB_Broker_Impl> > | 512 typedef IDMap<base::WeakPtr<webkit::ppapi::PPB_Broker_Impl> > |
514 PermissionRequestMap; | 513 PermissionRequestMap; |
515 PermissionRequestMap pending_permission_requests_; | 514 PermissionRequestMap pending_permission_requests_; |
516 | 515 |
517 // Whether or not the focus is on a PPAPI plugin | 516 // Whether or not the focus is on a PPAPI plugin |
518 webkit::ppapi::PluginInstance* focused_plugin_; | 517 webkit::ppapi::PluginInstance* focused_plugin_; |
(...skipping 12 matching lines...) Expand all Loading... |
531 | 530 |
532 scoped_ptr<PepperDeviceEnumerationEventHandler> | 531 scoped_ptr<PepperDeviceEnumerationEventHandler> |
533 device_enumeration_event_handler_; | 532 device_enumeration_event_handler_; |
534 | 533 |
535 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); | 534 DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
536 }; | 535 }; |
537 | 536 |
538 } // namespace content | 537 } // namespace content |
539 | 538 |
540 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ | 539 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_DELEGATE_IMPL_H_ |
OLD | NEW |