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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 void StopFind(); | 179 void StopFind(); |
180 | 180 |
181 bool SupportsPrintInterface(); | 181 bool SupportsPrintInterface(); |
182 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); | 182 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); |
183 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 183 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
184 void PrintEnd(); | 184 void PrintEnd(); |
185 | 185 |
186 void Graphics3DContextLost(); | 186 void Graphics3DContextLost(); |
187 | 187 |
188 // Implementation of PPB_Fullscreen_Dev. | 188 // Implementation of PPB_Fullscreen_Dev. |
| 189 |
| 190 // Because going to fullscreen is asynchronous (but going out is not), there |
| 191 // are 3 states: |
| 192 // - normal (fullscreen_container_ == NULL) |
| 193 // - fullscreen pending (fullscreen_container_ != NULL, fullscreen_ == false) |
| 194 // - fullscreen (fullscreen_container_ != NULL, fullscreen_ = true) |
| 195 // |
| 196 // In normal state, events come from webkit and painting goes back to it. |
| 197 // In fullscreen state, events come from the fullscreen container, and |
| 198 // painting goes back to it |
| 199 // In pending state, events from webkit are ignored, and as soon as we receive |
| 200 // events from the fullscreen container, we go to the fullscreen state. |
189 bool IsFullscreen(); | 201 bool IsFullscreen(); |
190 bool SetFullscreen(bool fullscreen); | 202 bool IsFullscreenOrPending(); |
| 203 |
| 204 // Switches between fullscreen and normal mode. If |delay_report| is set to |
| 205 // false, it may report the new state through DidChangeView immediately. If |
| 206 // true, it will delay it. When called from the plugin, delay_report should be |
| 207 // true to avoid re-entrancy. |
| 208 void SetFullscreen(bool fullscreen, bool delay_report); |
191 | 209 |
192 // Implementation of PPB_Flash. | 210 // Implementation of PPB_Flash. |
193 bool NavigateToURL(const char* url, const char* target); | 211 bool NavigateToURL(const char* url, const char* target); |
194 | 212 |
195 PluginDelegate::PlatformContext3D* CreateContext3D(); | 213 PluginDelegate::PlatformContext3D* CreateContext3D(); |
196 | 214 |
197 // Tracks all live ObjectVar. This is so we can map between PluginModule + | 215 // Tracks all live ObjectVar. This is so we can map between PluginModule + |
198 // NPObject and get the ObjectVar corresponding to it. This Add/Remove | 216 // NPObject and get the ObjectVar corresponding to it. This Add/Remove |
199 // function should be called by the ObjectVar when it is created and | 217 // function should be called by the ObjectVar when it is created and |
200 // destroyed. | 218 // destroyed. |
(...skipping 12 matching lines...) Expand all Loading... |
213 private: | 231 private: |
214 bool LoadFindInterface(); | 232 bool LoadFindInterface(); |
215 bool LoadPdfInterface(); | 233 bool LoadPdfInterface(); |
216 bool LoadSelectionInterface(); | 234 bool LoadSelectionInterface(); |
217 bool LoadZoomInterface(); | 235 bool LoadZoomInterface(); |
218 | 236 |
219 // Determines if we think the plugin has focus, both content area and webkit | 237 // Determines if we think the plugin has focus, both content area and webkit |
220 // (see has_webkit_focus_ below). | 238 // (see has_webkit_focus_ below). |
221 bool PluginHasFocus() const; | 239 bool PluginHasFocus() const; |
222 | 240 |
| 241 // Reports the current plugin geometry to the plugin by calling |
| 242 // DidChangeView. |
| 243 void ReportGeometry(); |
| 244 |
223 // Queries the plugin for supported print formats and sets |format| to the | 245 // Queries the plugin for supported print formats and sets |format| to the |
224 // best format to use. Returns false if the plugin does not support any | 246 // best format to use. Returns false if the plugin does not support any |
225 // print format that we can handle (we can handle raster and PDF). | 247 // print format that we can handle (we can handle raster and PDF). |
226 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); | 248 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
227 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 249 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
228 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 250 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
229 #if defined(OS_WIN) | 251 #if defined(OS_WIN) |
230 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, | 252 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, |
231 const gfx::Rect& printable_area, | 253 const gfx::Rect& printable_area, |
232 WebKit::WebCanvas* canvas); | 254 WebKit::WebCanvas* canvas); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 // The plugin 3D interface. | 343 // The plugin 3D interface. |
322 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; | 344 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; |
323 | 345 |
324 // Contains the cursor if it's set by the plugin. | 346 // Contains the cursor if it's set by the plugin. |
325 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 347 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
326 | 348 |
327 // Set to true if this plugin thinks it will always be on top. This allows us | 349 // Set to true if this plugin thinks it will always be on top. This allows us |
328 // to use a more optimized painting path in some cases. | 350 // to use a more optimized painting path in some cases. |
329 bool always_on_top_; | 351 bool always_on_top_; |
330 | 352 |
331 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. | 353 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note: |
| 354 // there is a transition state where fullscreen_container_ is non-NULL but |
| 355 // fullscreen_ is false (see above). |
332 FullscreenContainer* fullscreen_container_; | 356 FullscreenContainer* fullscreen_container_; |
333 | 357 |
| 358 // True if we are in fullscreen mode. Note: it is false during the transition. |
| 359 bool fullscreen_; |
| 360 |
334 typedef std::set<PluginObject*> PluginObjectSet; | 361 typedef std::set<PluginObject*> PluginObjectSet; |
335 PluginObjectSet live_plugin_objects_; | 362 PluginObjectSet live_plugin_objects_; |
336 | 363 |
337 // Tracks all live ObjectVars used by this module so we can map NPObjects to | 364 // Tracks all live ObjectVars used by this module so we can map NPObjects to |
338 // the corresponding object. These are non-owning references. | 365 // the corresponding object. These are non-owning references. |
339 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; | 366 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; |
340 NPObjectToObjectVarMap np_object_to_object_var_; | 367 NPObjectToObjectVarMap np_object_to_object_var_; |
341 | 368 |
342 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 369 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
343 }; | 370 }; |
344 | 371 |
345 } // namespace ppapi | 372 } // namespace ppapi |
346 } // namespace webkit | 373 } // namespace webkit |
347 | 374 |
348 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 375 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |