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) | |
viettrungluu
2011/03/08 00:06:01
I wonder if it'd be nicer to just have a state var
piman
2011/03/08 00:55:30
Now I would have 2 problems instead of 1 :)
| |
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. | |
viettrungluu
2011/03/08 00:06:01
How does it report the geometry?
piman
2011/03/08 00:55:30
Done.
| |
242 void ReportGeometry(); | |
243 | |
223 // Queries the plugin for supported print formats and sets |format| to the | 244 // 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 | 245 // 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). | 246 // print format that we can handle (we can handle raster and PDF). |
226 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); | 247 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
227 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 248 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
228 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 249 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
229 #if defined(OS_WIN) | 250 #if defined(OS_WIN) |
230 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, | 251 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, |
231 const gfx::Rect& printable_area, | 252 const gfx::Rect& printable_area, |
232 WebKit::WebCanvas* canvas); | 253 WebKit::WebCanvas* canvas); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 // The plugin 3D interface. | 342 // The plugin 3D interface. |
322 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; | 343 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; |
323 | 344 |
324 // Contains the cursor if it's set by the plugin. | 345 // Contains the cursor if it's set by the plugin. |
325 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 346 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
326 | 347 |
327 // Set to true if this plugin thinks it will always be on top. This allows us | 348 // 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. | 349 // to use a more optimized painting path in some cases. |
329 bool always_on_top_; | 350 bool always_on_top_; |
330 | 351 |
331 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. | 352 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note: |
353 // there is a transition state where fullscreen_container_ is non-NULL but | |
354 // fullscreen_ is true (see above). | |
viettrungluu
2011/03/08 00:06:01
is false?
| |
332 FullscreenContainer* fullscreen_container_; | 355 FullscreenContainer* fullscreen_container_; |
333 | 356 |
357 // True if we are in fullscreen mode. Note: it is false during the transition. | |
358 bool fullscreen_; | |
359 | |
334 typedef std::set<PluginObject*> PluginObjectSet; | 360 typedef std::set<PluginObject*> PluginObjectSet; |
335 PluginObjectSet live_plugin_objects_; | 361 PluginObjectSet live_plugin_objects_; |
336 | 362 |
337 // Tracks all live ObjectVars used by this module so we can map NPObjects to | 363 // Tracks all live ObjectVars used by this module so we can map NPObjects to |
338 // the corresponding object. These are non-owning references. | 364 // the corresponding object. These are non-owning references. |
339 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; | 365 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; |
340 NPObjectToObjectVarMap np_object_to_object_var_; | 366 NPObjectToObjectVarMap np_object_to_object_var_; |
341 | 367 |
342 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 368 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
343 }; | 369 }; |
344 | 370 |
345 } // namespace ppapi | 371 } // namespace ppapi |
346 } // namespace webkit | 372 } // namespace webkit |
347 | 373 |
348 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 374 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |