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 WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ppapi/c/pp_time.h" | 28 #include "ppapi/c/pp_time.h" |
29 #include "ppapi/c/pp_var.h" | 29 #include "ppapi/c/pp_var.h" |
30 #include "ppapi/c/ppb_audio_config.h" | 30 #include "ppapi/c/ppb_audio_config.h" |
31 #include "ppapi/c/ppb_input_event.h" | 31 #include "ppapi/c/ppb_input_event.h" |
32 #include "ppapi/c/ppb_gamepad.h" | 32 #include "ppapi/c/ppb_gamepad.h" |
33 #include "ppapi/c/ppp_graphics_3d.h" | 33 #include "ppapi/c/ppp_graphics_3d.h" |
34 #include "ppapi/c/ppp_input_event.h" | 34 #include "ppapi/c/ppp_input_event.h" |
35 #include "ppapi/c/ppp_messaging.h" | 35 #include "ppapi/c/ppp_messaging.h" |
36 #include "ppapi/c/ppp_mouse_lock.h" | 36 #include "ppapi/c/ppp_mouse_lock.h" |
37 #include "ppapi/c/private/ppp_instance_private.h" | 37 #include "ppapi/c/private/ppp_instance_private.h" |
38 #include "ppapi/shared_impl/function_group_base.h" | |
39 #include "ppapi/shared_impl/ppb_instance_shared.h" | 38 #include "ppapi/shared_impl/ppb_instance_shared.h" |
40 #include "ppapi/shared_impl/ppb_view_shared.h" | 39 #include "ppapi/shared_impl/ppb_view_shared.h" |
41 #include "third_party/skia/include/core/SkRefCnt.h" | 40 #include "third_party/skia/include/core/SkRefCnt.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 41 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
45 #include "ui/base/ime/text_input_type.h" | 44 #include "ui/base/ime/text_input_type.h" |
46 #include "ui/gfx/rect.h" | 45 #include "ui/gfx/rect.h" |
47 #include "webkit/plugins/ppapi/plugin_delegate.h" | 46 #include "webkit/plugins/ppapi/plugin_delegate.h" |
48 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 47 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
49 #include "webkit/plugins/ppapi/ppp_pdf.h" | 48 #include "webkit/plugins/ppapi/ppp_pdf.h" |
| 49 #include "webkit/plugins/ppapi/resource_creation_impl.h" |
50 #include "webkit/plugins/webkit_plugins_export.h" | 50 #include "webkit/plugins/webkit_plugins_export.h" |
51 | 51 |
52 struct PP_Point; | 52 struct PP_Point; |
53 | 53 |
54 class SkBitmap; | 54 class SkBitmap; |
55 class TransportDIB; | 55 class TransportDIB; |
56 | 56 |
57 namespace WebKit { | 57 namespace WebKit { |
58 class WebInputEvent; | 58 class WebInputEvent; |
59 class WebMouseEvent; | 59 class WebMouseEvent; |
(...skipping 26 matching lines...) Expand all Loading... |
86 class PPB_URLLoader_Impl; | 86 class PPB_URLLoader_Impl; |
87 class PPB_URLRequestInfo_Impl; | 87 class PPB_URLRequestInfo_Impl; |
88 | 88 |
89 // Represents one time a plugin appears on one web page. | 89 // Represents one time a plugin appears on one web page. |
90 // | 90 // |
91 // Note: to get from a PP_Instance to a PluginInstance*, use the | 91 // Note: to get from a PP_Instance to a PluginInstance*, use the |
92 // ResourceTracker. | 92 // ResourceTracker. |
93 class WEBKIT_PLUGINS_EXPORT PluginInstance : | 93 class WEBKIT_PLUGINS_EXPORT PluginInstance : |
94 public base::RefCounted<PluginInstance>, | 94 public base::RefCounted<PluginInstance>, |
95 public base::SupportsWeakPtr<PluginInstance>, | 95 public base::SupportsWeakPtr<PluginInstance>, |
96 public ::ppapi::FunctionGroupBase, | |
97 public ::ppapi::PPB_Instance_Shared { | 96 public ::ppapi::PPB_Instance_Shared { |
98 public: | 97 public: |
99 // Create and return a PluginInstance object which supports the | 98 // Create and return a PluginInstance object which supports the |
100 // given version. | 99 // given version. |
101 static PluginInstance* Create1_0(PluginDelegate* delegate, | 100 static PluginInstance* Create1_0(PluginDelegate* delegate, |
102 PluginModule* module, | 101 PluginModule* module, |
103 const void* ppp_instance_if_1_0); | 102 const void* ppp_instance_if_1_0); |
104 static PluginInstance* Create1_1(PluginDelegate* delegate, | 103 static PluginInstance* Create1_1(PluginDelegate* delegate, |
105 PluginModule* module, | 104 PluginModule* module, |
106 const void* ppp_instance_if_1_1); | 105 const void* ppp_instance_if_1_1); |
107 | 106 |
108 // Delete should be called by the WebPlugin before this destructor. | 107 // Delete should be called by the WebPlugin before this destructor. |
109 virtual ~PluginInstance(); | 108 virtual ~PluginInstance(); |
110 | 109 |
111 PluginDelegate* delegate() const { return delegate_; } | 110 PluginDelegate* delegate() const { return delegate_; } |
112 PluginModule* module() const { return module_.get(); } | 111 PluginModule* module() const { return module_.get(); } |
113 MessageChannel& message_channel() { return *message_channel_; } | 112 MessageChannel& message_channel() { return *message_channel_; } |
114 | 113 |
115 WebKit::WebPluginContainer* container() const { return container_; } | 114 WebKit::WebPluginContainer* container() const { return container_; } |
116 | 115 |
117 void set_always_on_top(bool on_top) { always_on_top_ = on_top; } | 116 void set_always_on_top(bool on_top) { always_on_top_ = on_top; } |
118 | 117 |
119 // Returns the PP_Instance uniquely identifying this instance. Guaranteed | 118 // Returns the PP_Instance uniquely identifying this instance. Guaranteed |
120 // nonzero. | 119 // nonzero. |
121 PP_Instance pp_instance() const { return pp_instance_; } | 120 PP_Instance pp_instance() const { return pp_instance_; } |
122 | 121 |
| 122 ResourceCreationImpl& resource_creation() { return resource_creation_; } |
| 123 |
123 // Does some pre-destructor cleanup on the instance. This is necessary | 124 // Does some pre-destructor cleanup on the instance. This is necessary |
124 // because some cleanup depends on the plugin instance still existing (like | 125 // because some cleanup depends on the plugin instance still existing (like |
125 // calling the plugin's DidDestroy function). This function is called from | 126 // calling the plugin's DidDestroy function). This function is called from |
126 // the WebPlugin implementation when WebKit is about to remove the plugin. | 127 // the WebPlugin implementation when WebKit is about to remove the plugin. |
127 void Delete(); | 128 void Delete(); |
128 | 129 |
129 // Paints the current backing store to the web page. | 130 // Paints the current backing store to the web page. |
130 void Paint(WebKit::WebCanvas* canvas, | 131 void Paint(WebKit::WebCanvas* canvas, |
131 const gfx::Rect& plugin_rect, | 132 const gfx::Rect& plugin_rect, |
132 const gfx::Rect& paint_rect); | 133 const gfx::Rect& paint_rect); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 void OnLockMouseACK(bool succeeded); | 318 void OnLockMouseACK(bool succeeded); |
318 // A mouse lock was in place, but has been lost. | 319 // A mouse lock was in place, but has been lost. |
319 void OnMouseLockLost(); | 320 void OnMouseLockLost(); |
320 // A mouse lock is enabled and mouse events are being delievered. | 321 // A mouse lock is enabled and mouse events are being delievered. |
321 void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); | 322 void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); |
322 | 323 |
323 // Simulates an input event to the plugin by passing it down to WebKit, | 324 // Simulates an input event to the plugin by passing it down to WebKit, |
324 // which sends it back up to the plugin as if it came from the user. | 325 // which sends it back up to the plugin as if it came from the user. |
325 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); | 326 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); |
326 | 327 |
327 // FunctionGroupBase overrides. | 328 // PPB_Instance_API implementation. |
328 virtual ::ppapi::thunk::PPB_Instance_FunctionAPI* | |
329 AsPPB_Instance_FunctionAPI() OVERRIDE; | |
330 | |
331 // PPB_Instance_FunctionAPI implementation. | |
332 virtual PP_Bool BindGraphics(PP_Instance instance, | 329 virtual PP_Bool BindGraphics(PP_Instance instance, |
333 PP_Resource device) OVERRIDE; | 330 PP_Resource device) OVERRIDE; |
334 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; | 331 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; |
335 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; | 332 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; |
336 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; | 333 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; |
337 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; | 334 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; |
338 virtual PP_Var ExecuteScript(PP_Instance instance, | 335 virtual PP_Var ExecuteScript(PP_Instance instance, |
339 PP_Var script, | 336 PP_Var script, |
340 PP_Var* exception) OVERRIDE; | 337 PP_Var* exception) OVERRIDE; |
341 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) | 338 virtual uint32_t GetAudioHardwareOutputSampleRate(PP_Instance instance) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 // We track two types of focus, one from WebKit, which is the focus among | 515 // We track two types of focus, one from WebKit, which is the focus among |
519 // all elements of the page, one one from the browser, which is whether the | 516 // all elements of the page, one one from the browser, which is whether the |
520 // tab/window has focus. We tell the plugin it has focus only when both of | 517 // tab/window has focus. We tell the plugin it has focus only when both of |
521 // these values are set to true. | 518 // these values are set to true. |
522 bool has_webkit_focus_; | 519 bool has_webkit_focus_; |
523 bool has_content_area_focus_; | 520 bool has_content_area_focus_; |
524 | 521 |
525 // The id of the current find operation, or -1 if none is in process. | 522 // The id of the current find operation, or -1 if none is in process. |
526 int find_identifier_; | 523 int find_identifier_; |
527 | 524 |
| 525 // Helper object that creates resources. |
| 526 ResourceCreationImpl resource_creation_; |
| 527 |
528 // The plugin-provided interfaces. | 528 // The plugin-provided interfaces. |
529 const PPP_Find_Dev* plugin_find_interface_; | 529 const PPP_Find_Dev* plugin_find_interface_; |
530 const PPP_Messaging* plugin_messaging_interface_; | 530 const PPP_Messaging* plugin_messaging_interface_; |
531 const PPP_MouseLock* plugin_mouse_lock_interface_; | 531 const PPP_MouseLock* plugin_mouse_lock_interface_; |
532 const PPP_InputEvent* plugin_input_event_interface_; | 532 const PPP_InputEvent* plugin_input_event_interface_; |
533 const PPP_Instance_Private* plugin_private_interface_; | 533 const PPP_Instance_Private* plugin_private_interface_; |
534 const PPP_Pdf* plugin_pdf_interface_; | 534 const PPP_Pdf* plugin_pdf_interface_; |
535 const PPP_Selection_Dev* plugin_selection_interface_; | 535 const PPP_Selection_Dev* plugin_selection_interface_; |
536 const PPP_TextInput_Dev* plugin_textinput_interface_; | 536 const PPP_TextInput_Dev* plugin_textinput_interface_; |
537 const PPP_Zoom_Dev* plugin_zoom_interface_; | 537 const PPP_Zoom_Dev* plugin_zoom_interface_; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 // The Flash proxy is associated with the instance. | 642 // The Flash proxy is associated with the instance. |
643 PPB_Flash_Impl flash_impl_; | 643 PPB_Flash_Impl flash_impl_; |
644 | 644 |
645 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 645 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
646 }; | 646 }; |
647 | 647 |
648 } // namespace ppapi | 648 } // namespace ppapi |
649 } // namespace webkit | 649 } // namespace webkit |
650 | 650 |
651 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 651 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |