| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "gfx/rect.h" | 15 #include "gfx/rect.h" |
| 16 #include "third_party/ppapi/c/dev/pp_cursor_type_dev.h" | 16 #include "third_party/ppapi/c/dev/pp_cursor_type_dev.h" |
| 17 #include "third_party/ppapi/c/dev/ppp_graphics_3d_dev.h" | 17 #include "third_party/ppapi/c/dev/ppp_graphics_3d_dev.h" |
| 18 #include "third_party/ppapi/c/dev/ppp_printing_dev.h" | 18 #include "third_party/ppapi/c/dev/ppp_printing_dev.h" |
| 19 #include "third_party/ppapi/c/pp_instance.h" | 19 #include "third_party/ppapi/c/pp_instance.h" |
| 20 #include "third_party/ppapi/c/pp_resource.h" | 20 #include "third_party/ppapi/c/pp_resource.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" |
| 23 | 23 |
| 24 struct PP_Var; | 24 struct PP_Var; |
| 25 struct PPB_Instance; | 25 struct PPB_Instance; |
| 26 struct PPB_Find_Dev; | 26 struct PPB_Find_Dev; |
| 27 struct PPB_Fullscreen_Dev; |
| 27 struct PPP_Find_Dev; | 28 struct PPP_Find_Dev; |
| 28 struct PPP_Instance; | 29 struct PPP_Instance; |
| 29 struct PPP_Zoom_Dev; | 30 struct PPP_Zoom_Dev; |
| 30 | 31 |
| 31 class SkBitmap; | 32 class SkBitmap; |
| 32 | 33 |
| 33 namespace gfx { | 34 namespace gfx { |
| 34 class Rect; | 35 class Rect; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace WebKit { | 38 namespace WebKit { |
| 38 struct WebCursorInfo; | 39 struct WebCursorInfo; |
| 39 class WebInputEvent; | 40 class WebInputEvent; |
| 40 class WebPluginContainer; | 41 class WebPluginContainer; |
| 41 } | 42 } |
| 42 | 43 |
| 43 namespace pepper { | 44 namespace pepper { |
| 44 | 45 |
| 45 class Graphics2D; | 46 class Graphics2D; |
| 46 class ImageData; | 47 class ImageData; |
| 47 class PluginDelegate; | 48 class PluginDelegate; |
| 48 class PluginModule; | 49 class PluginModule; |
| 49 class URLLoader; | 50 class URLLoader; |
| 51 class FullscreenContainer; |
| 50 | 52 |
| 51 class PluginInstance : public base::RefCounted<PluginInstance> { | 53 class PluginInstance : public base::RefCounted<PluginInstance> { |
| 52 public: | 54 public: |
| 53 PluginInstance(PluginDelegate* delegate, | 55 PluginInstance(PluginDelegate* delegate, |
| 54 PluginModule* module, | 56 PluginModule* module, |
| 55 const PPP_Instance* instance_interface); | 57 const PPP_Instance* instance_interface); |
| 56 ~PluginInstance(); | 58 ~PluginInstance(); |
| 57 | 59 |
| 58 static const PPB_Instance* GetInterface(); | 60 static const PPB_Instance* GetInterface(); |
| 59 | 61 |
| 60 // Converts the given instance ID to an actual instance object. | 62 // Converts the given instance ID to an actual instance object. |
| 61 static PluginInstance* FromPPInstance(PP_Instance instance); | 63 static PluginInstance* FromPPInstance(PP_Instance instance); |
| 62 | 64 |
| 63 // Returns a pointer to the interface implementing PPB_Find that is | 65 // Returns a pointer to the interface implementing PPB_Find that is |
| 64 // exposed to the plugin. | 66 // exposed to the plugin. |
| 65 static const PPB_Find_Dev* GetFindInterface(); | 67 static const PPB_Find_Dev* GetFindInterface(); |
| 68 static const PPB_Fullscreen_Dev* GetFullscreenInterface(); |
| 66 | 69 |
| 67 PluginDelegate* delegate() const { return delegate_; } | 70 PluginDelegate* delegate() const { return delegate_; } |
| 68 PluginModule* module() const { return module_.get(); } | 71 PluginModule* module() const { return module_.get(); } |
| 69 | 72 |
| 70 WebKit::WebPluginContainer* container() const { return container_; } | 73 WebKit::WebPluginContainer* container() const { return container_; } |
| 71 | 74 |
| 72 const gfx::Rect& position() const { return position_; } | 75 const gfx::Rect& position() const { return position_; } |
| 73 const gfx::Rect& clip() const { return clip_; } | 76 const gfx::Rect& clip() const { return clip_; } |
| 74 | 77 |
| 75 int find_identifier() const { return find_identifier_; } | 78 int find_identifier() const { return find_identifier_; } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 void SelectFindResult(bool forward); | 124 void SelectFindResult(bool forward); |
| 122 void StopFind(); | 125 void StopFind(); |
| 123 | 126 |
| 124 bool SupportsPrintInterface(); | 127 bool SupportsPrintInterface(); |
| 125 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); | 128 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); |
| 126 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 129 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
| 127 void PrintEnd(); | 130 void PrintEnd(); |
| 128 | 131 |
| 129 void Graphics3DContextLost(); | 132 void Graphics3DContextLost(); |
| 130 | 133 |
| 134 // Implementation of PPB_Fullscreen_Dev. |
| 135 bool IsFullscreen(); |
| 136 bool SetFullscreen(bool fullscreen); |
| 137 |
| 131 private: | 138 private: |
| 132 bool LoadFindInterface(); | 139 bool LoadFindInterface(); |
| 133 bool LoadZoomInterface(); | 140 bool LoadZoomInterface(); |
| 134 | 141 |
| 135 // Queries the plugin for supported print formats and sets |format| to the | 142 // Queries the plugin for supported print formats and sets |format| to the |
| 136 // best format to use. Returns false if the plugin does not support any | 143 // best format to use. Returns false if the plugin does not support any |
| 137 // print format that we can handle (we can handle raster and PDF). | 144 // print format that we can handle (we can handle raster and PDF). |
| 138 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); | 145 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
| 139 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 146 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
| 140 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 147 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 210 |
| 204 // The plugin print interface. | 211 // The plugin print interface. |
| 205 const PPP_Printing_Dev* plugin_print_interface_; | 212 const PPP_Printing_Dev* plugin_print_interface_; |
| 206 | 213 |
| 207 // The plugin 3D interface. | 214 // The plugin 3D interface. |
| 208 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; | 215 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; |
| 209 | 216 |
| 210 // Containes the cursor if it's set by the plugin. | 217 // Containes the cursor if it's set by the plugin. |
| 211 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 218 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
| 212 | 219 |
| 220 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. |
| 221 FullscreenContainer* fullscreen_container_; |
| 222 |
| 213 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 223 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 214 }; | 224 }; |
| 215 | 225 |
| 216 } // namespace pepper | 226 } // namespace pepper |
| 217 | 227 |
| 218 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ | 228 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_INSTANCE_H_ |
| OLD | NEW |