OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
17 #include "base/string16.h" | 18 #include "base/string16.h" |
18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
19 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 20 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 21 #include "ppapi/c/dev/ppb_content_decryption_module_dev.h" |
| 22 #include "ppapi/c/dev/ppp_content_decryption_module_dev.h" |
20 #include "ppapi/c/dev/ppp_printing_dev.h" | 23 #include "ppapi/c/dev/ppp_printing_dev.h" |
21 #include "ppapi/c/dev/ppp_find_dev.h" | 24 #include "ppapi/c/dev/ppp_find_dev.h" |
22 #include "ppapi/c/dev/ppp_selection_dev.h" | 25 #include "ppapi/c/dev/ppp_selection_dev.h" |
23 #include "ppapi/c/dev/ppp_text_input_dev.h" | 26 #include "ppapi/c/dev/ppp_text_input_dev.h" |
24 #include "ppapi/c/dev/ppp_zoom_dev.h" | 27 #include "ppapi/c/dev/ppp_zoom_dev.h" |
25 #include "ppapi/c/pp_completion_callback.h" | 28 #include "ppapi/c/pp_completion_callback.h" |
26 #include "ppapi/c/pp_instance.h" | 29 #include "ppapi/c/pp_instance.h" |
27 #include "ppapi/c/pp_resource.h" | 30 #include "ppapi/c/pp_resource.h" |
28 #include "ppapi/c/pp_time.h" | 31 #include "ppapi/c/pp_time.h" |
29 #include "ppapi/c/pp_var.h" | 32 #include "ppapi/c/pp_var.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bool IsPrintScalingDisabled(); | 233 bool IsPrintScalingDisabled(); |
231 int PrintBegin(const WebKit::WebPrintParams& print_params); | 234 int PrintBegin(const WebKit::WebPrintParams& print_params); |
232 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 235 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
233 void PrintEnd(); | 236 void PrintEnd(); |
234 | 237 |
235 bool CanRotateView(); | 238 bool CanRotateView(); |
236 void RotateView(WebKit::WebPlugin::RotationType type); | 239 void RotateView(WebKit::WebPlugin::RotationType type); |
237 | 240 |
238 void Graphics3DContextLost(); | 241 void Graphics3DContextLost(); |
239 | 242 |
| 243 // Implementation of PPP_ContentDecryptionModule_Dev. |
| 244 typedef base::Callback<void(void*, int)> CDMStatusCB; |
| 245 bool GenerateKeyRequest(const std::string& key_system, |
| 246 const std::string& init_data); |
| 247 bool AddKey(const std::string& session_id, |
| 248 const std::string& key); |
| 249 bool CancelKeyRequest(const std::string& session_id); |
| 250 bool Decrypt(const std::string& encypted_block, |
| 251 const CDMStatusCB& callback); |
| 252 bool DecryptAndDecode(const std::string& encypted_block, |
| 253 const CDMStatusCB& callback); |
| 254 |
240 // There are 2 implementations of the fullscreen interface | 255 // There are 2 implementations of the fullscreen interface |
241 // PPB_FlashFullscreen is used by Pepper Flash. | 256 // PPB_FlashFullscreen is used by Pepper Flash. |
242 // PPB_Fullscreen is intended for other applications including NaCl. | 257 // PPB_Fullscreen is intended for other applications including NaCl. |
243 // The two interface are mutually exclusive. | 258 // The two interface are mutually exclusive. |
244 | 259 |
245 // Implementation of PPB_FlashFullscreen. | 260 // Implementation of PPB_FlashFullscreen. |
246 | 261 |
247 // Because going to fullscreen is asynchronous (but going out is not), there | 262 // Because going to fullscreen is asynchronous (but going out is not), there |
248 // are 3 states: | 263 // are 3 states: |
249 // - normal : fullscreen_container_ == NULL | 264 // - normal : fullscreen_container_ == NULL |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 PP_Var relative, | 412 PP_Var relative, |
398 PP_URLComponents_Dev* components) OVERRIDE; | 413 PP_URLComponents_Dev* components) OVERRIDE; |
399 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; | 414 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; |
400 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, | 415 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
401 PP_Instance target) OVERRIDE; | 416 PP_Instance target) OVERRIDE; |
402 virtual PP_Var GetDocumentURL(PP_Instance instance, | 417 virtual PP_Var GetDocumentURL(PP_Instance instance, |
403 PP_URLComponents_Dev* components) OVERRIDE; | 418 PP_URLComponents_Dev* components) OVERRIDE; |
404 virtual PP_Var GetPluginInstanceURL( | 419 virtual PP_Var GetPluginInstanceURL( |
405 PP_Instance instance, | 420 PP_Instance instance, |
406 PP_URLComponents_Dev* components) OVERRIDE; | 421 PP_URLComponents_Dev* components) OVERRIDE; |
| 422 virtual void NeedKey(PP_Instance instance, |
| 423 PP_Var key_system, |
| 424 PP_Var session_id, |
| 425 PP_Resource init_data) OVERRIDE; |
| 426 virtual void KeyAdded(PP_Instance instance, |
| 427 PP_Var key_system, |
| 428 PP_Var session_id) OVERRIDE; |
| 429 virtual void KeyMessage(PP_Instance instance, |
| 430 PP_Var key_system, |
| 431 PP_Var session_id, |
| 432 PP_Resource message, |
| 433 PP_Var default_url) OVERRIDE; |
| 434 virtual void KeyError(PP_Instance instance, |
| 435 PP_Var key_system, |
| 436 PP_Var session_id, |
| 437 uint16_t media_error, |
| 438 uint16_t system_error) OVERRIDE; |
| 439 virtual void DeliverBlock(PP_Instance instance, |
| 440 PP_Resource decrypted_block, |
| 441 PP_CompletionCallback callback) OVERRIDE; |
| 442 virtual void DeliverFrame(PP_Instance instance, |
| 443 PP_Resource decrypted_frame, |
| 444 PP_CompletionCallback callback) OVERRIDE; |
| 445 virtual void DeliverSamples(PP_Instance instance, |
| 446 PP_Resource decrypted_samples, |
| 447 PP_CompletionCallback callback) OVERRIDE; |
407 | 448 |
408 private: | 449 private: |
409 // See the static Create functions above for creating PluginInstance objects. | 450 // See the static Create functions above for creating PluginInstance objects. |
410 // This constructor is private so that we can hide the PPP_Instance_Combined | 451 // This constructor is private so that we can hide the PPP_Instance_Combined |
411 // details while still having 1 constructor to maintain for member | 452 // details while still having 1 constructor to maintain for member |
412 // initialization. | 453 // initialization. |
413 PluginInstance(PluginDelegate* delegate, | 454 PluginInstance(PluginDelegate* delegate, |
414 PluginModule* module, | 455 PluginModule* module, |
415 ::ppapi::PPP_Instance_Combined* instance_interface); | 456 ::ppapi::PPP_Instance_Combined* instance_interface); |
416 | 457 |
| 458 bool LoadContentDecryptionModuleInterface(); |
417 bool LoadFindInterface(); | 459 bool LoadFindInterface(); |
418 bool LoadInputEventInterface(); | 460 bool LoadInputEventInterface(); |
419 bool LoadMessagingInterface(); | 461 bool LoadMessagingInterface(); |
420 bool LoadMouseLockInterface(); | 462 bool LoadMouseLockInterface(); |
421 bool LoadPdfInterface(); | 463 bool LoadPdfInterface(); |
422 bool LoadPrintInterface(); | 464 bool LoadPrintInterface(); |
423 bool LoadPrivateInterface(); | 465 bool LoadPrivateInterface(); |
424 bool LoadSelectionInterface(); | 466 bool LoadSelectionInterface(); |
425 bool LoadTextInputInterface(); | 467 bool LoadTextInputInterface(); |
426 bool LoadZoomInterface(); | 468 bool LoadZoomInterface(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 bool has_webkit_focus_; | 571 bool has_webkit_focus_; |
530 bool has_content_area_focus_; | 572 bool has_content_area_focus_; |
531 | 573 |
532 // The id of the current find operation, or -1 if none is in process. | 574 // The id of the current find operation, or -1 if none is in process. |
533 int find_identifier_; | 575 int find_identifier_; |
534 | 576 |
535 // Helper object that creates resources. | 577 // Helper object that creates resources. |
536 ResourceCreationImpl resource_creation_; | 578 ResourceCreationImpl resource_creation_; |
537 | 579 |
538 // The plugin-provided interfaces. | 580 // The plugin-provided interfaces. |
| 581 const PPP_ContentDecryptionModule_Dev* plugin_decryption_interface_; |
539 const PPP_Find_Dev* plugin_find_interface_; | 582 const PPP_Find_Dev* plugin_find_interface_; |
540 const PPP_Messaging* plugin_messaging_interface_; | 583 const PPP_Messaging* plugin_messaging_interface_; |
541 const PPP_MouseLock* plugin_mouse_lock_interface_; | 584 const PPP_MouseLock* plugin_mouse_lock_interface_; |
542 const PPP_InputEvent* plugin_input_event_interface_; | 585 const PPP_InputEvent* plugin_input_event_interface_; |
543 const PPP_Instance_Private* plugin_private_interface_; | 586 const PPP_Instance_Private* plugin_private_interface_; |
544 const PPP_Pdf* plugin_pdf_interface_; | 587 const PPP_Pdf* plugin_pdf_interface_; |
545 const PPP_Selection_Dev* plugin_selection_interface_; | 588 const PPP_Selection_Dev* plugin_selection_interface_; |
546 const PPP_TextInput_Dev* plugin_textinput_interface_; | 589 const PPP_TextInput_Dev* plugin_textinput_interface_; |
547 const PPP_Zoom_Dev* plugin_zoom_interface_; | 590 const PPP_Zoom_Dev* plugin_zoom_interface_; |
548 | 591 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // The Flash proxy is associated with the instance. | 695 // The Flash proxy is associated with the instance. |
653 PPB_Flash_Impl flash_impl_; | 696 PPB_Flash_Impl flash_impl_; |
654 | 697 |
655 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 698 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
656 }; | 699 }; |
657 | 700 |
658 } // namespace ppapi | 701 } // namespace ppapi |
659 } // namespace webkit | 702 } // namespace webkit |
660 | 703 |
661 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 704 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |