| 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_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "cc/layers/texture_layer_client.h" | 18 #include "cc/layers/texture_layer_client.h" |
| 19 #include "content/common/content_export.h" | 19 #include "content/common/content_export.h" |
| 20 #include "content/public/renderer/pepper_plugin_instance.h" | 20 #include "content/public/renderer/pepper_plugin_instance.h" |
| 21 #include "content/renderer/mouse_lock_dispatcher.h" | 21 #include "content/renderer/mouse_lock_dispatcher.h" |
| 22 #include "content/renderer/pepper/plugin_delegate.h" | |
| 23 #include "content/renderer/pepper/ppp_pdf.h" | 22 #include "content/renderer/pepper/ppp_pdf.h" |
| 24 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 23 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 25 #include "ppapi/c/dev/ppp_find_dev.h" | 24 #include "ppapi/c/dev/ppp_find_dev.h" |
| 26 #include "ppapi/c/dev/ppp_printing_dev.h" | 25 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 27 #include "ppapi/c/dev/ppp_selection_dev.h" | 26 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 28 #include "ppapi/c/dev/ppp_text_input_dev.h" | 27 #include "ppapi/c/dev/ppp_text_input_dev.h" |
| 29 #include "ppapi/c/dev/ppp_zoom_dev.h" | 28 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 30 #include "ppapi/c/pp_completion_callback.h" | 29 #include "ppapi/c/pp_completion_callback.h" |
| 31 #include "ppapi/c/pp_instance.h" | 30 #include "ppapi/c/pp_instance.h" |
| 32 #include "ppapi/c/pp_time.h" | 31 #include "ppapi/c/pp_time.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 namespace v8 { | 92 namespace v8 { |
| 94 class Isolate; | 93 class Isolate; |
| 95 } | 94 } |
| 96 | 95 |
| 97 namespace content { | 96 namespace content { |
| 98 | 97 |
| 99 class ContentDecryptorDelegate; | 98 class ContentDecryptorDelegate; |
| 100 class FullscreenContainer; | 99 class FullscreenContainer; |
| 101 class MessageChannel; | 100 class MessageChannel; |
| 102 class PepperGraphics2DHost; | 101 class PepperGraphics2DHost; |
| 103 class PluginDelegate; | 102 class PepperPluginDelegateImpl; |
| 104 class PluginModule; | 103 class PluginModule; |
| 105 class PluginObject; | 104 class PluginObject; |
| 106 class PPB_Graphics3D_Impl; | 105 class PPB_Graphics3D_Impl; |
| 107 class PPB_ImageData_Impl; | 106 class PPB_ImageData_Impl; |
| 108 class PPB_URLLoader_Impl; | 107 class PPB_URLLoader_Impl; |
| 109 class RenderViewImpl; | 108 class RenderViewImpl; |
| 110 | 109 |
| 111 // Represents one time a plugin appears on one web page. | 110 // Represents one time a plugin appears on one web page. |
| 112 // | 111 // |
| 113 // Note: to get from a PP_Instance to a PepperPluginInstance*, use the | 112 // Note: to get from a PP_Instance to a PepperPluginInstance*, use the |
| 114 // ResourceTracker. | 113 // ResourceTracker. |
| 115 class CONTENT_EXPORT PepperPluginInstanceImpl | 114 class CONTENT_EXPORT PepperPluginInstanceImpl |
| 116 : public base::RefCounted<PepperPluginInstanceImpl>, | 115 : public base::RefCounted<PepperPluginInstanceImpl>, |
| 117 public base::SupportsWeakPtr<PepperPluginInstanceImpl>, | 116 public base::SupportsWeakPtr<PepperPluginInstanceImpl>, |
| 118 public NON_EXPORTED_BASE(PepperPluginInstance), | 117 public NON_EXPORTED_BASE(PepperPluginInstance), |
| 119 public ::ppapi::PPB_Instance_Shared { | 118 public ::ppapi::PPB_Instance_Shared { |
| 120 public: | 119 public: |
| 121 // Create and return a PepperPluginInstanceImpl object which supports the most | 120 // Create and return a PepperPluginInstanceImpl object which supports the most |
| 122 // recent version of PPP_Instance possible by querying the given | 121 // recent version of PPP_Instance possible by querying the given |
| 123 // get_plugin_interface function. If the plugin does not support any valid | 122 // get_plugin_interface function. If the plugin does not support any valid |
| 124 // PPP_Instance interface, returns NULL. | 123 // PPP_Instance interface, returns NULL. |
| 125 static PepperPluginInstanceImpl* Create( | 124 static PepperPluginInstanceImpl* Create( |
| 126 PluginDelegate* delegate, | 125 PepperPluginDelegateImpl* delegate, |
| 127 RenderViewImpl* render_view, | 126 RenderViewImpl* render_view, |
| 128 PluginModule* module, | 127 PluginModule* module, |
| 129 WebKit::WebPluginContainer* container, | 128 WebKit::WebPluginContainer* container, |
| 130 const GURL& plugin_url); | 129 const GURL& plugin_url); |
| 131 PluginDelegate* delegate() const { return delegate_; } | 130 PepperPluginDelegateImpl* delegate() const { return delegate_; } |
| 132 RenderViewImpl* render_view() const { return render_view_; } | 131 RenderViewImpl* render_view() const { return render_view_; } |
| 133 PluginModule* module() const { return module_.get(); } | 132 PluginModule* module() const { return module_.get(); } |
| 134 MessageChannel& message_channel() { return *message_channel_; } | 133 MessageChannel& message_channel() { return *message_channel_; } |
| 135 | 134 |
| 136 WebKit::WebPluginContainer* container() const { return container_; } | 135 WebKit::WebPluginContainer* container() const { return container_; } |
| 137 | 136 |
| 138 // Returns the PP_Instance uniquely identifying this instance. Guaranteed | 137 // Returns the PP_Instance uniquely identifying this instance. Guaranteed |
| 139 // nonzero. | 138 // nonzero. |
| 140 PP_Instance pp_instance() const { return pp_instance_; } | 139 PP_Instance pp_instance() const { return pp_instance_; } |
| 141 | 140 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 std::list<std::string> data_; | 533 std::list<std::string> data_; |
| 535 bool finished_loading_; | 534 bool finished_loading_; |
| 536 scoped_ptr<WebKit::WebURLError> error_; | 535 scoped_ptr<WebKit::WebURLError> error_; |
| 537 }; | 536 }; |
| 538 | 537 |
| 539 // Implements PPB_Gamepad_API. This is just to avoid having an excessive | 538 // Implements PPB_Gamepad_API. This is just to avoid having an excessive |
| 540 // number of interfaces implemented by PepperPluginInstanceImpl. | 539 // number of interfaces implemented by PepperPluginInstanceImpl. |
| 541 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API, | 540 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API, |
| 542 public ::ppapi::Resource { | 541 public ::ppapi::Resource { |
| 543 public: | 542 public: |
| 544 explicit GamepadImpl(PluginDelegate* delegate); | 543 explicit GamepadImpl(PepperPluginDelegateImpl* delegate); |
| 545 // Resource implementation. | 544 // Resource implementation. |
| 546 virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; | 545 virtual ::ppapi::thunk::PPB_Gamepad_API* AsPPB_Gamepad_API() OVERRIDE; |
| 547 virtual void Sample(PP_Instance instance, | 546 virtual void Sample(PP_Instance instance, |
| 548 PP_GamepadsSampleData* data) OVERRIDE; | 547 PP_GamepadsSampleData* data) OVERRIDE; |
| 549 private: | 548 private: |
| 550 virtual ~GamepadImpl(); | 549 virtual ~GamepadImpl(); |
| 551 PluginDelegate* delegate_; | 550 PepperPluginDelegateImpl* delegate_; |
| 552 }; | 551 }; |
| 553 | 552 |
| 554 // See the static Create functions above for creating PepperPluginInstanceImpl | 553 // See the static Create functions above for creating PepperPluginInstanceImpl |
| 555 // objects. This constructor is private so that we can hide the | 554 // objects. This constructor is private so that we can hide the |
| 556 // PPP_Instance_Combined details while still having 1 constructor to maintain | 555 // PPP_Instance_Combined details while still having 1 constructor to maintain |
| 557 // for member initialization. | 556 // for member initialization. |
| 558 PepperPluginInstanceImpl(PluginDelegate* delegate, | 557 PepperPluginInstanceImpl(PepperPluginDelegateImpl* delegate, |
| 559 RenderViewImpl* render_view, | 558 RenderViewImpl* render_view, |
| 560 PluginModule* module, | 559 PluginModule* module, |
| 561 ::ppapi::PPP_Instance_Combined* instance_interface, | 560 ::ppapi::PPP_Instance_Combined* instance_interface, |
| 562 WebKit::WebPluginContainer* container, | 561 WebKit::WebPluginContainer* container, |
| 563 const GURL& plugin_url); | 562 const GURL& plugin_url); |
| 564 | 563 |
| 565 bool LoadFindInterface(); | 564 bool LoadFindInterface(); |
| 566 bool LoadInputEventInterface(); | 565 bool LoadInputEventInterface(); |
| 567 bool LoadMessagingInterface(); | 566 bool LoadMessagingInterface(); |
| 568 bool LoadMouseLockInterface(); | 567 bool LoadMouseLockInterface(); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 void KeepSizeAttributesBeforeFullscreen(); | 639 void KeepSizeAttributesBeforeFullscreen(); |
| 641 void SetSizeAttributesForFullscreen(); | 640 void SetSizeAttributesForFullscreen(); |
| 642 void ResetSizeAttributesAfterFullscreen(); | 641 void ResetSizeAttributesAfterFullscreen(); |
| 643 | 642 |
| 644 bool IsMouseLocked(); | 643 bool IsMouseLocked(); |
| 645 bool LockMouse(); | 644 bool LockMouse(); |
| 646 MouseLockDispatcher* GetMouseLockDispatcher(); | 645 MouseLockDispatcher* GetMouseLockDispatcher(); |
| 647 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); | 646 MouseLockDispatcher::LockTarget* GetOrCreateLockTargetAdapter(); |
| 648 void UnSetAndDeleteLockTargetAdapter(); | 647 void UnSetAndDeleteLockTargetAdapter(); |
| 649 | 648 |
| 650 PluginDelegate* delegate_; | 649 PepperPluginDelegateImpl* delegate_; |
| 651 RenderViewImpl* render_view_; | 650 RenderViewImpl* render_view_; |
| 652 scoped_refptr<PluginModule> module_; | 651 scoped_refptr<PluginModule> module_; |
| 653 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; | 652 scoped_ptr< ::ppapi::PPP_Instance_Combined> instance_interface_; |
| 654 // If this is the NaCl plugin, we create a new module when we switch to the | 653 // If this is the NaCl plugin, we create a new module when we switch to the |
| 655 // IPC-based PPAPI proxy. Store the original module and instance interface | 654 // IPC-based PPAPI proxy. Store the original module and instance interface |
| 656 // so we can shut down properly. | 655 // so we can shut down properly. |
| 657 scoped_refptr<PluginModule> original_module_; | 656 scoped_refptr<PluginModule> original_module_; |
| 658 scoped_ptr< ::ppapi::PPP_Instance_Combined> original_instance_interface_; | 657 scoped_ptr< ::ppapi::PPP_Instance_Combined> original_instance_interface_; |
| 659 | 658 |
| 660 PP_Instance pp_instance_; | 659 PP_Instance pp_instance_; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 854 |
| 856 scoped_ptr<MouseLockDispatcher::LockTarget> lock_target_; | 855 scoped_ptr<MouseLockDispatcher::LockTarget> lock_target_; |
| 857 | 856 |
| 858 friend class PpapiPluginInstanceTest; | 857 friend class PpapiPluginInstanceTest; |
| 859 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); | 858 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); |
| 860 }; | 859 }; |
| 861 | 860 |
| 862 } // namespace content | 861 } // namespace content |
| 863 | 862 |
| 864 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 863 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| OLD | NEW |