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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 MessageChannel& message_channel() { return *message_channel_; } | 113 MessageChannel& message_channel() { return *message_channel_; } |
114 | 114 |
115 WebKit::WebPluginContainer* container() const { return container_; } | 115 WebKit::WebPluginContainer* container() const { return container_; } |
116 | 116 |
117 void set_always_on_top(bool on_top) { always_on_top_ = on_top; } | 117 void set_always_on_top(bool on_top) { always_on_top_ = on_top; } |
118 | 118 |
119 // Returns the PP_Instance uniquely identifying this instance. Guaranteed | 119 // Returns the PP_Instance uniquely identifying this instance. Guaranteed |
120 // nonzero. | 120 // nonzero. |
121 PP_Instance pp_instance() const { return pp_instance_; } | 121 PP_Instance pp_instance() const { return pp_instance_; } |
122 | 122 |
| 123 ::ppapi::PPP_Instance_Combined* instance_interface() const { |
| 124 return instance_interface_.get(); |
| 125 } |
| 126 |
123 ::ppapi::thunk::ResourceCreationAPI& resource_creation() { | 127 ::ppapi::thunk::ResourceCreationAPI& resource_creation() { |
124 return *resource_creation_.get(); | 128 return *resource_creation_.get(); |
125 } | 129 } |
126 | 130 |
127 // Does some pre-destructor cleanup on the instance. This is necessary | 131 // Does some pre-destructor cleanup on the instance. This is necessary |
128 // because some cleanup depends on the plugin instance still existing (like | 132 // because some cleanup depends on the plugin instance still existing (like |
129 // calling the plugin's DidDestroy function). This function is called from | 133 // calling the plugin's DidDestroy function). This function is called from |
130 // the WebPlugin implementation when WebKit is about to remove the plugin. | 134 // the WebPlugin implementation when WebKit is about to remove the plugin. |
131 void Delete(); | 135 void Delete(); |
132 | 136 |
(...skipping 22 matching lines...) Expand all Loading... |
155 void CommitBackingTexture(); | 159 void CommitBackingTexture(); |
156 | 160 |
157 // Called when the out-of-process plugin implementing this instance crashed. | 161 // Called when the out-of-process plugin implementing this instance crashed. |
158 void InstanceCrashed(); | 162 void InstanceCrashed(); |
159 | 163 |
160 // PPB_Instance and PPB_Instance_Private implementation. | 164 // PPB_Instance and PPB_Instance_Private implementation. |
161 const GURL& plugin_url() const { return plugin_url_; } | 165 const GURL& plugin_url() const { return plugin_url_; } |
162 bool full_frame() const { return full_frame_; } | 166 bool full_frame() const { return full_frame_; } |
163 const ::ppapi::ViewData& view_data() const { return view_data_; } | 167 const ::ppapi::ViewData& view_data() const { return view_data_; } |
164 | 168 |
165 // PPP_Instance and PPP_Instance_Private pass-through. | 169 // PPP_Instance and PPP_Instance_Private. |
166 bool Initialize(WebKit::WebPluginContainer* container, | 170 bool Initialize(WebKit::WebPluginContainer* container, |
167 const std::vector<std::string>& arg_names, | 171 const std::vector<std::string>& arg_names, |
168 const std::vector<std::string>& arg_values, | 172 const std::vector<std::string>& arg_values, |
169 const GURL& plugin_url, | 173 const GURL& plugin_url, |
170 bool full_frame); | 174 bool full_frame); |
171 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); | 175 bool HandleDocumentLoad(const WebKit::WebURLResponse& response); |
172 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 176 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
173 WebKit::WebCursorInfo* cursor_info); | 177 WebKit::WebCursorInfo* cursor_info); |
174 PP_Var GetInstanceObject(); | 178 PP_Var GetInstanceObject(); |
175 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip, | 179 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip, |
176 const std::vector<gfx::Rect>& cut_outs_rects); | 180 const std::vector<gfx::Rect>& cut_outs_rects); |
177 | 181 |
178 // Handlers for composition events. | 182 // Handlers for composition events. |
179 bool HandleCompositionStart(const string16& text); | 183 bool HandleCompositionStart(const string16& text); |
180 bool HandleCompositionUpdate( | 184 bool HandleCompositionUpdate( |
181 const string16& text, | 185 const string16& text, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Simulates an input event to the plugin by passing it down to WebKit, | 333 // Simulates an input event to the plugin by passing it down to WebKit, |
330 // which sends it back up to the plugin as if it came from the user. | 334 // which sends it back up to the plugin as if it came from the user. |
331 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); | 335 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); |
332 | 336 |
333 // Simulates an IME event at the level of RenderView which sends it back up to | 337 // Simulates an IME event at the level of RenderView which sends it back up to |
334 // the plugin as if it came from the user. | 338 // the plugin as if it came from the user. |
335 bool SimulateIMEEvent(const ::ppapi::InputEventData& input_event); | 339 bool SimulateIMEEvent(const ::ppapi::InputEventData& input_event); |
336 void SimulateImeSetCompositionEvent( | 340 void SimulateImeSetCompositionEvent( |
337 const ::ppapi::InputEventData& input_event); | 341 const ::ppapi::InputEventData& input_event); |
338 | 342 |
| 343 // The document loader is valid when the plugin is "full-frame" and in this |
| 344 // case is non-NULL as long as the corresponding loader resource is alive. |
| 345 // This pointer is non-owning, so the loader must use set_document_loader to |
| 346 // clear itself when it is destroyed. |
| 347 WebKit::WebURLLoaderClient* document_loader() const { |
| 348 return document_loader_; |
| 349 } |
| 350 void set_document_loader(WebKit::WebURLLoaderClient* loader) { |
| 351 document_loader_ = loader; |
| 352 } |
| 353 |
339 ContentDecryptorDelegate* GetContentDecryptorDelegate(); | 354 ContentDecryptorDelegate* GetContentDecryptorDelegate(); |
340 | 355 |
341 // PPB_Instance_API implementation. | 356 // PPB_Instance_API implementation. |
342 virtual PP_Bool BindGraphics(PP_Instance instance, | 357 virtual PP_Bool BindGraphics(PP_Instance instance, |
343 PP_Resource device) OVERRIDE; | 358 PP_Resource device) OVERRIDE; |
344 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; | 359 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; |
345 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; | 360 virtual const ::ppapi::ViewData* GetViewData(PP_Instance instance) OVERRIDE; |
346 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; | 361 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; |
347 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; | 362 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; |
348 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; | 363 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 PP_TimeTicks pending_user_gesture_; | 759 PP_TimeTicks pending_user_gesture_; |
745 | 760 |
746 // The Flash proxy is associated with the instance. | 761 // The Flash proxy is associated with the instance. |
747 PPB_Flash_Impl flash_impl_; | 762 PPB_Flash_Impl flash_impl_; |
748 | 763 |
749 // We store the arguments so we can re-send them if we are reset to talk to | 764 // We store the arguments so we can re-send them if we are reset to talk to |
750 // NaCl via the IPC NaCl proxy. | 765 // NaCl via the IPC NaCl proxy. |
751 std::vector<std::string> argn_; | 766 std::vector<std::string> argn_; |
752 std::vector<std::string> argv_; | 767 std::vector<std::string> argv_; |
753 | 768 |
754 // This is NULL unless HandleDocumentLoad has called. In that case, we store | 769 // Non-owning pointer to the document loader, if any. |
755 // the pointer so we can re-send it later if we are reset to talk to NaCl. | 770 WebKit::WebURLLoaderClient* document_loader_; |
756 scoped_refptr<PPB_URLLoader_Impl> document_loader_; | |
757 | 771 |
758 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private | 772 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private |
759 // calls and handles PPB_ContentDecryptor_Private calls. | 773 // calls and handles PPB_ContentDecryptor_Private calls. |
760 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; | 774 scoped_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; |
761 | 775 |
762 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 776 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
763 }; | 777 }; |
764 | 778 |
765 } // namespace ppapi | 779 } // namespace ppapi |
766 } // namespace webkit | 780 } // namespace webkit |
767 | 781 |
768 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 782 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |