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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 void SelectFindResult(bool forward); | 200 void SelectFindResult(bool forward); |
201 void StopFind(); | 201 void StopFind(); |
202 | 202 |
203 bool SupportsPrintInterface(); | 203 bool SupportsPrintInterface(); |
204 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); | 204 int PrintBegin(const gfx::Rect& printable_area, int printer_dpi); |
205 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 205 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
206 void PrintEnd(); | 206 void PrintEnd(); |
207 | 207 |
208 void Graphics3DContextLost(); | 208 void Graphics3DContextLost(); |
209 | 209 |
| 210 // There are 2 implementations of the fullscreen interface. PPB_Fullscreen_Dev |
| 211 // is used by Pepper Flash. PPB_Fullscreen is intended for other applications |
| 212 // including NaCl. The two interface are mutually exclusive. |
| 213 |
210 // Implementation of PPB_Fullscreen_Dev. | 214 // Implementation of PPB_Fullscreen_Dev. |
211 | 215 |
212 // Because going to fullscreen is asynchronous (but going out is not), there | 216 // Because going to fullscreen is asynchronous (but going out is not), there |
213 // are 3 states: | 217 // are 3 states: |
214 // - normal (fullscreen_container_ == NULL) | 218 // - normal : fullscreen_container_ == NULL |
215 // - fullscreen pending (fullscreen_container_ != NULL, fullscreen_ == false) | 219 // fullscreen_dev_ == false |
216 // - fullscreen (fullscreen_container_ != NULL, fullscreen_ = true) | 220 // - fullscreen pending: fullscreen_container_ != NULL |
| 221 // fullscreen_dev_ == false |
| 222 // - fullscreen : fullscreen_container_ != NULL |
| 223 // fullscreen_dev_ == true |
217 // | 224 // |
218 // In normal state, events come from webkit and painting goes back to it. | 225 // In normal state, events come from webkit and painting goes back to it. |
219 // In fullscreen state, events come from the fullscreen container, and | 226 // In fullscreen state, events come from the fullscreen container, and |
220 // painting goes back to it | 227 // painting goes back to it. |
221 // In pending state, events from webkit are ignored, and as soon as we receive | 228 // In pending state, events from webkit are ignored, and as soon as we receive |
222 // events from the fullscreen container, we go to the fullscreen state. | 229 // events from the fullscreen container, we go to the fullscreen state. |
| 230 bool IsFullscreenOrPending_Dev(); |
| 231 |
| 232 // Switches between fullscreen and normal mode. If |delay_report| is set to |
| 233 // false, it may report the new state through DidChangeView immediately. If |
| 234 // true, it will delay it. When called from the plugin, delay_report should be |
| 235 // true to avoid re-entrancy. |
| 236 void SetFullscreen_Dev(bool fullscreen, bool delay_report); |
| 237 |
| 238 FullscreenContainer* fullscreen_container() const { |
| 239 return fullscreen_container_; |
| 240 } |
| 241 |
| 242 // Implementation of PPB_Fullscreen. |
| 243 |
| 244 // Because going to/from fullscreen is asynchronous, there are 4 states: |
| 245 // - normal : desired_fullscreen_state_ == false |
| 246 // fullscreen_ == false |
| 247 // - fullscreen pending: desired_fullscreen_state_ == true |
| 248 // fullscreen_ == false |
| 249 // - fullscreen : desired_fullscreen_state_ == true |
| 250 // fullscreen_ == true |
| 251 // - normal pending : desired_fullscreen_state_ = false |
| 252 // fullscreen_ = true |
223 bool IsFullscreenOrPending(); | 253 bool IsFullscreenOrPending(); |
224 | 254 |
225 // Switches between fullscreen and normal mode. If |delay_report| is set to | 255 // Switches between fullscreen and normal mode. If |delay_report| is set to |
226 // false, it may report the new state through DidChangeView immediately. If | 256 // false, it may report the new state through DidChangeView immediately. If |
227 // true, it will delay it. When called from the plugin, delay_report should be | 257 // true, it will delay it. When called from the plugin, delay_report should be |
228 // true to avoid re-entrancy. | 258 // true to avoid re-entrancy. |
229 void SetFullscreen(bool fullscreen, bool delay_report); | 259 void SetFullscreen(bool fullscreen, bool delay_report); |
230 | 260 |
231 // Implementation of PPB_Flash. | 261 // Implementation of PPB_Flash. |
232 int32_t Navigate(PPB_URLRequestInfo_Impl* request, | 262 int32_t Navigate(PPB_URLRequestInfo_Impl* request, |
233 const char* target, | 263 const char* target, |
234 bool from_user_action); | 264 bool from_user_action); |
235 | 265 |
236 // Implementation of PPP_Messaging. | 266 // Implementation of PPP_Messaging. |
237 void HandleMessage(PP_Var message); | 267 void HandleMessage(PP_Var message); |
238 | 268 |
239 PluginDelegate::PlatformContext3D* CreateContext3D(); | 269 PluginDelegate::PlatformContext3D* CreateContext3D(); |
240 | 270 |
241 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe or | 271 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe or |
242 // embedded in a page). | 272 // embedded in a page). |
243 bool IsFullPagePlugin() const; | 273 bool IsFullPagePlugin() const; |
244 | 274 |
245 FullscreenContainer* fullscreen_container() const { | |
246 return fullscreen_container_; | |
247 } | |
248 | |
249 // FunctionGroupBase overrides. | 275 // FunctionGroupBase overrides. |
250 virtual ::ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI() | 276 virtual ::ppapi::thunk::PPB_Instance_FunctionAPI* AsPPB_Instance_FunctionAPI() |
251 OVERRIDE; | 277 OVERRIDE; |
252 | 278 |
253 // PPB_Instance_API implementation. | 279 // PPB_Instance_FunctionAPI implementation. |
254 virtual PP_Bool BindGraphics(PP_Instance instance, | 280 virtual PP_Bool BindGraphics(PP_Instance instance, |
255 PP_Resource device) OVERRIDE; | 281 PP_Resource device) OVERRIDE; |
256 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; | 282 virtual PP_Bool IsFullFrame(PP_Instance instance) OVERRIDE; |
257 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; | 283 virtual PP_Var GetWindowObject(PP_Instance instance) OVERRIDE; |
258 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; | 284 virtual PP_Var GetOwnerElementObject(PP_Instance instance) OVERRIDE; |
259 virtual PP_Var ExecuteScript(PP_Instance instance, | 285 virtual PP_Var ExecuteScript(PP_Instance instance, |
260 PP_Var script, | 286 PP_Var script, |
261 PP_Var* exception) OVERRIDE; | 287 PP_Var* exception) OVERRIDE; |
262 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; | 288 virtual PP_Bool IsFullscreen(PP_Instance instance) OVERRIDE; |
| 289 virtual PP_Bool IsFullscreen_Dev(PP_Instance instance) OVERRIDE; |
263 virtual PP_Bool SetFullscreen(PP_Instance instance, | 290 virtual PP_Bool SetFullscreen(PP_Instance instance, |
264 PP_Bool fullscreen) OVERRIDE; | 291 PP_Bool fullscreen) OVERRIDE; |
| 292 virtual PP_Bool SetFullscreen_Dev(PP_Instance instance, |
| 293 PP_Bool fullscreen) OVERRIDE; |
265 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; | 294 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) OVERRIDE; |
| 295 virtual PP_Bool GetScreenSize_Dev(PP_Instance instance, PP_Size* size) |
| 296 OVERRIDE; |
266 virtual int32_t RequestInputEvents(PP_Instance instance, | 297 virtual int32_t RequestInputEvents(PP_Instance instance, |
267 uint32_t event_classes) OVERRIDE; | 298 uint32_t event_classes) OVERRIDE; |
268 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, | 299 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, |
269 uint32_t event_classes) OVERRIDE; | 300 uint32_t event_classes) OVERRIDE; |
270 virtual void ClearInputEventRequest(PP_Instance instance, | 301 virtual void ClearInputEventRequest(PP_Instance instance, |
271 uint32_t event_classes) OVERRIDE; | 302 uint32_t event_classes) OVERRIDE; |
272 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; | 303 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; |
273 virtual void ZoomLimitsChanged(PP_Instance instance, | 304 virtual void ZoomLimitsChanged(PP_Instance instance, |
274 double minimum_factor, | 305 double minimum_factor, |
275 double maximium_factor) OVERRIDE; | 306 double maximium_factor) OVERRIDE; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 // The plugin 3D interface. | 465 // The plugin 3D interface. |
435 const PPP_Graphics3D* plugin_graphics_3d_interface_; | 466 const PPP_Graphics3D* plugin_graphics_3d_interface_; |
436 | 467 |
437 // Contains the cursor if it's set by the plugin. | 468 // Contains the cursor if it's set by the plugin. |
438 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 469 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
439 | 470 |
440 // Set to true if this plugin thinks it will always be on top. This allows us | 471 // Set to true if this plugin thinks it will always be on top. This allows us |
441 // to use a more optimized painting path in some cases. | 472 // to use a more optimized painting path in some cases. |
442 bool always_on_top_; | 473 bool always_on_top_; |
443 | 474 |
| 475 // Implementation of PPB_Fullscreen_Dev. |
| 476 |
444 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note: | 477 // Plugin container for fullscreen mode. NULL if not in fullscreen mode. Note: |
445 // there is a transition state where fullscreen_container_ is non-NULL but | 478 // there is a transition state where fullscreen_container_ is non-NULL but |
446 // fullscreen_ is false (see above). | 479 // fullscreen_ is false (see above). |
447 FullscreenContainer* fullscreen_container_; | 480 FullscreenContainer* fullscreen_container_; |
448 | 481 |
449 // True if we are in fullscreen mode. Note: it is false during the transition. | 482 // True if we are in fullscreen mode. False if we are in normal mode or |
| 483 // in transition to fullscreen. |
| 484 bool fullscreen_dev_; |
| 485 |
| 486 // Implementation of PPB_Fullscreen. |
| 487 |
| 488 // Since entering fullscreen mode is an asynchronous operation, we set this |
| 489 // variable to the desired state at the time we issue the fullscreen change |
| 490 // request. The plugin will receive a DidChangeView event when it goes |
| 491 // fullscreen. |
| 492 bool desired_fullscreen_state_; |
| 493 |
| 494 // True if we are in fullscreen mode. False if we are in normal mode. |
| 495 // It reflects the previous state when in transition. |
450 bool fullscreen_; | 496 bool fullscreen_; |
451 | 497 |
452 // The MessageChannel used to implement bidirectional postMessage for the | 498 // The MessageChannel used to implement bidirectional postMessage for the |
453 // instance. | 499 // instance. |
454 scoped_ptr<MessageChannel> message_channel_; | 500 scoped_ptr<MessageChannel> message_channel_; |
455 | 501 |
456 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 502 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
457 SkBitmap* sad_plugin_; | 503 SkBitmap* sad_plugin_; |
458 | 504 |
459 typedef std::set<PluginObject*> PluginObjectSet; | 505 typedef std::set<PluginObject*> PluginObjectSet; |
460 PluginObjectSet live_plugin_objects_; | 506 PluginObjectSet live_plugin_objects_; |
461 | 507 |
462 // Classes of events that the plugin has registered for, both for filtering | 508 // Classes of events that the plugin has registered for, both for filtering |
463 // and not. The bits are PP_INPUTEVENT_CLASS_*. | 509 // and not. The bits are PP_INPUTEVENT_CLASS_*. |
464 uint32_t input_event_mask_; | 510 uint32_t input_event_mask_; |
465 uint32_t filtered_input_event_mask_; | 511 uint32_t filtered_input_event_mask_; |
466 | 512 |
467 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 513 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
468 }; | 514 }; |
469 | 515 |
470 } // namespace ppapi | 516 } // namespace ppapi |
471 } // namespace webkit | 517 } // namespace webkit |
472 | 518 |
473 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 519 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |