| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ppapi/c/pp_instance.h" | 21 #include "ppapi/c/pp_instance.h" |
| 22 #include "ppapi/c/pp_resource.h" | 22 #include "ppapi/c/pp_resource.h" |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 23 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCanvas.h" |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 #include "webkit/plugins/ppapi/plugin_delegate.h" | 26 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 27 | 27 |
| 28 typedef struct NPObject NPObject; | 28 typedef struct NPObject NPObject; |
| 29 struct PP_Var; | 29 struct PP_Var; |
| 30 struct PPB_Instance; | 30 struct PPB_Instance; |
| 31 struct PPB_Instance_Private; |
| 31 struct PPB_Find_Dev; | 32 struct PPB_Find_Dev; |
| 32 struct PPB_Fullscreen_Dev; | 33 struct PPB_Fullscreen_Dev; |
| 33 struct PPB_Messaging; | 34 struct PPB_Messaging; |
| 34 struct PPB_Zoom_Dev; | 35 struct PPB_Zoom_Dev; |
| 35 struct PPP_Find_Dev; | 36 struct PPP_Find_Dev; |
| 36 struct PPP_Instance; | 37 struct PPP_Instance; |
| 38 struct PPP_Instance_Private; |
| 37 struct PPP_Messaging; | 39 struct PPP_Messaging; |
| 38 struct PPP_Pdf; | 40 struct PPP_Pdf; |
| 39 struct PPP_Selection_Dev; | 41 struct PPP_Selection_Dev; |
| 40 struct PPP_Zoom_Dev; | 42 struct PPP_Zoom_Dev; |
| 41 | 43 |
| 42 class SkBitmap; | 44 class SkBitmap; |
| 43 class TransportDIB; | 45 class TransportDIB; |
| 44 | 46 |
| 45 namespace gfx { | 47 namespace gfx { |
| 46 class Rect; | 48 class Rect; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 class PluginInstance : public base::RefCounted<PluginInstance> { | 77 class PluginInstance : public base::RefCounted<PluginInstance> { |
| 76 public: | 78 public: |
| 77 PluginInstance(PluginDelegate* delegate, | 79 PluginInstance(PluginDelegate* delegate, |
| 78 PluginModule* module, | 80 PluginModule* module, |
| 79 const PPP_Instance* instance_interface); | 81 const PPP_Instance* instance_interface); |
| 80 | 82 |
| 81 // Delete should be called by the WebPlugin before this destructor. | 83 // Delete should be called by the WebPlugin before this destructor. |
| 82 ~PluginInstance(); | 84 ~PluginInstance(); |
| 83 | 85 |
| 84 static const PPB_Instance* GetInterface(); | 86 static const PPB_Instance* GetInterface(); |
| 87 static const PPB_Instance_Private* GetPrivateInterface(); |
| 85 | 88 |
| 86 // Returns a pointer to the interface implementing PPB_Find that is | 89 // Returns a pointer to the interface implementing PPB_Find that is |
| 87 // exposed to the plugin. | 90 // exposed to the plugin. |
| 88 static const PPB_Find_Dev* GetFindInterface(); | 91 static const PPB_Find_Dev* GetFindInterface(); |
| 89 static const PPB_Fullscreen_Dev* GetFullscreenInterface(); | 92 static const PPB_Fullscreen_Dev* GetFullscreenInterface(); |
| 90 static const PPB_Messaging* GetMessagingInterface(); | 93 static const PPB_Messaging* GetMessagingInterface(); |
| 91 static const PPB_Zoom_Dev* GetZoomInterface(); | 94 static const PPB_Zoom_Dev* GetZoomInterface(); |
| 92 | 95 |
| 93 PluginDelegate* delegate() const { return delegate_; } | 96 PluginDelegate* delegate() const { return delegate_; } |
| 94 PluginModule* module() const { return module_.get(); } | 97 PluginModule* module() const { return module_.get(); } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // compositor's namespace. Otherwise return 0. Returns 0 by default. | 136 // compositor's namespace. Otherwise return 0. Returns 0 by default. |
| 134 virtual unsigned GetBackingTextureId(); | 137 virtual unsigned GetBackingTextureId(); |
| 135 | 138 |
| 136 // Commit the backing texture to the screen once the side effects some | 139 // Commit the backing texture to the screen once the side effects some |
| 137 // rendering up to an offscreen SwapBuffers are visible. | 140 // rendering up to an offscreen SwapBuffers are visible. |
| 138 void CommitBackingTexture(); | 141 void CommitBackingTexture(); |
| 139 | 142 |
| 140 // Called when the out-of-process plugin implementing this instance crashed. | 143 // Called when the out-of-process plugin implementing this instance crashed. |
| 141 void InstanceCrashed(); | 144 void InstanceCrashed(); |
| 142 | 145 |
| 143 // PPB_Instance implementation. | 146 // PPB_Instance and PPB_Instance_Private implementation. |
| 144 PP_Var GetWindowObject(); | 147 PP_Var GetWindowObject(); |
| 145 PP_Var GetOwnerElementObject(); | 148 PP_Var GetOwnerElementObject(); |
| 146 bool BindGraphics(PP_Resource graphics_id); | 149 bool BindGraphics(PP_Resource graphics_id); |
| 147 const GURL& plugin_url() const { return plugin_url_; } | 150 const GURL& plugin_url() const { return plugin_url_; } |
| 148 bool full_frame() const { return full_frame_; } | 151 bool full_frame() const { return full_frame_; } |
| 149 // If |type| is not PP_CURSORTYPE_CUSTOM, |custom_image| and |hot_spot| are | 152 // If |type| is not PP_CURSORTYPE_CUSTOM, |custom_image| and |hot_spot| are |
| 150 // ignored. | 153 // ignored. |
| 151 bool SetCursor(PP_CursorType_Dev type, | 154 bool SetCursor(PP_CursorType_Dev type, |
| 152 PP_Resource custom_image, | 155 PP_Resource custom_image, |
| 153 const PP_Point* hot_spot); | 156 const PP_Point* hot_spot); |
| 154 PP_Var ExecuteScript(PP_Var script, PP_Var* exception); | 157 PP_Var ExecuteScript(PP_Var script, PP_Var* exception); |
| 155 | 158 |
| 156 // PPP_Instance pass-through. | 159 // PPP_Instance and PPP_Instance_Private pass-through. |
| 157 bool Initialize(WebKit::WebPluginContainer* container, | 160 bool Initialize(WebKit::WebPluginContainer* container, |
| 158 const std::vector<std::string>& arg_names, | 161 const std::vector<std::string>& arg_names, |
| 159 const std::vector<std::string>& arg_values, | 162 const std::vector<std::string>& arg_values, |
| 160 const GURL& plugin_url, | 163 const GURL& plugin_url, |
| 161 bool full_frame); | 164 bool full_frame); |
| 162 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); | 165 bool HandleDocumentLoad(PPB_URLLoader_Impl* loader); |
| 163 bool HandleInputEvent(const WebKit::WebInputEvent& event, | 166 bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 164 WebKit::WebCursorInfo* cursor_info); | 167 WebKit::WebCursorInfo* cursor_info); |
| 165 PP_Var GetInstanceObject(); | 168 PP_Var GetInstanceObject(); |
| 166 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); | 169 void ViewChanged(const gfx::Rect& position, const gfx::Rect& clip); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 259 |
| 257 FullscreenContainer* fullscreen_container() const { | 260 FullscreenContainer* fullscreen_container() const { |
| 258 return fullscreen_container_; | 261 return fullscreen_container_; |
| 259 } | 262 } |
| 260 | 263 |
| 261 private: | 264 private: |
| 262 bool LoadFindInterface(); | 265 bool LoadFindInterface(); |
| 263 bool LoadMessagingInterface(); | 266 bool LoadMessagingInterface(); |
| 264 bool LoadPdfInterface(); | 267 bool LoadPdfInterface(); |
| 265 bool LoadSelectionInterface(); | 268 bool LoadSelectionInterface(); |
| 269 bool LoadPrivateInterface(); |
| 266 bool LoadZoomInterface(); | 270 bool LoadZoomInterface(); |
| 267 | 271 |
| 268 // Determines if we think the plugin has focus, both content area and webkit | 272 // Determines if we think the plugin has focus, both content area and webkit |
| 269 // (see has_webkit_focus_ below). | 273 // (see has_webkit_focus_ below). |
| 270 bool PluginHasFocus() const; | 274 bool PluginHasFocus() const; |
| 271 | 275 |
| 272 // Reports the current plugin geometry to the plugin by calling | 276 // Reports the current plugin geometry to the plugin by calling |
| 273 // DidChangeView. | 277 // DidChangeView. |
| 274 void ReportGeometry(); | 278 void ReportGeometry(); |
| 275 | 279 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 bool has_content_area_focus_; | 349 bool has_content_area_focus_; |
| 346 | 350 |
| 347 // The id of the current find operation, or -1 if none is in process. | 351 // The id of the current find operation, or -1 if none is in process. |
| 348 int find_identifier_; | 352 int find_identifier_; |
| 349 | 353 |
| 350 // The plugin-provided interfaces. | 354 // The plugin-provided interfaces. |
| 351 const PPP_Find_Dev* plugin_find_interface_; | 355 const PPP_Find_Dev* plugin_find_interface_; |
| 352 const PPP_Messaging* plugin_messaging_interface_; | 356 const PPP_Messaging* plugin_messaging_interface_; |
| 353 const PPP_Pdf* plugin_pdf_interface_; | 357 const PPP_Pdf* plugin_pdf_interface_; |
| 354 const PPP_Selection_Dev* plugin_selection_interface_; | 358 const PPP_Selection_Dev* plugin_selection_interface_; |
| 359 const PPP_Instance_Private* plugin_private_interface_; |
| 355 const PPP_Zoom_Dev* plugin_zoom_interface_; | 360 const PPP_Zoom_Dev* plugin_zoom_interface_; |
| 356 | 361 |
| 357 // A flag to indicate whether we have asked this plugin instance for its | 362 // A flag to indicate whether we have asked this plugin instance for its |
| 358 // messaging interface, so that we can ask only once. | 363 // messaging interface, so that we can ask only once. |
| 359 bool checked_for_plugin_messaging_interface_; | 364 bool checked_for_plugin_messaging_interface_; |
| 360 | 365 |
| 361 // This is only valid between a successful PrintBegin call and a PrintEnd | 366 // This is only valid between a successful PrintBegin call and a PrintEnd |
| 362 // call. | 367 // call. |
| 363 PP_PrintSettings_Dev current_print_settings_; | 368 PP_PrintSettings_Dev current_print_settings_; |
| 364 #if defined(OS_MACOSX) | 369 #if defined(OS_MACOSX) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; | 422 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; |
| 418 NPObjectToObjectVarMap np_object_to_object_var_; | 423 NPObjectToObjectVarMap np_object_to_object_var_; |
| 419 | 424 |
| 420 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 425 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 421 }; | 426 }; |
| 422 | 427 |
| 423 } // namespace ppapi | 428 } // namespace ppapi |
| 424 } // namespace webkit | 429 } // namespace webkit |
| 425 | 430 |
| 426 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 431 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |