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_decryptor_dev.h" |
| 22 #include "ppapi/c/dev/ppp_content_decryptor_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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 bool IsPrintScalingDisabled(); | 232 bool IsPrintScalingDisabled(); |
230 int PrintBegin(const WebKit::WebPrintParams& print_params); | 233 int PrintBegin(const WebKit::WebPrintParams& print_params); |
231 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 234 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
232 void PrintEnd(); | 235 void PrintEnd(); |
233 | 236 |
234 bool CanRotateView(); | 237 bool CanRotateView(); |
235 void RotateView(WebKit::WebPlugin::RotationType type); | 238 void RotateView(WebKit::WebPlugin::RotationType type); |
236 | 239 |
237 void Graphics3DContextLost(); | 240 void Graphics3DContextLost(); |
238 | 241 |
| 242 // Provides access to PPP_ContentDecryptor_Dev. |
| 243 typedef base::Callback<void(void*, int)> CDMStatusCB; |
| 244 bool GenerateKeyRequest(const std::string& key_system, |
| 245 const std::string& init_data); |
| 246 bool AddKey(const std::string& session_id, |
| 247 const std::string& key); |
| 248 bool CancelKeyRequest(const std::string& session_id); |
| 249 bool Decrypt(const std::string& encypted_block, |
| 250 const CDMStatusCB& callback); |
| 251 bool DecryptAndDecode(const std::string& encypted_block, |
| 252 const CDMStatusCB& callback); |
| 253 |
239 // There are 2 implementations of the fullscreen interface | 254 // There are 2 implementations of the fullscreen interface |
240 // PPB_FlashFullscreen is used by Pepper Flash. | 255 // PPB_FlashFullscreen is used by Pepper Flash. |
241 // PPB_Fullscreen is intended for other applications including NaCl. | 256 // PPB_Fullscreen is intended for other applications including NaCl. |
242 // The two interface are mutually exclusive. | 257 // The two interface are mutually exclusive. |
243 | 258 |
244 // Implementation of PPB_FlashFullscreen. | 259 // Implementation of PPB_FlashFullscreen. |
245 | 260 |
246 // Because going to fullscreen is asynchronous (but going out is not), there | 261 // Because going to fullscreen is asynchronous (but going out is not), there |
247 // are 3 states: | 262 // are 3 states: |
248 // - normal : fullscreen_container_ == NULL | 263 // - normal : fullscreen_container_ == NULL |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 PP_Var relative, | 416 PP_Var relative, |
402 PP_URLComponents_Dev* components) OVERRIDE; | 417 PP_URLComponents_Dev* components) OVERRIDE; |
403 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; | 418 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; |
404 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, | 419 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
405 PP_Instance target) OVERRIDE; | 420 PP_Instance target) OVERRIDE; |
406 virtual PP_Var GetDocumentURL(PP_Instance instance, | 421 virtual PP_Var GetDocumentURL(PP_Instance instance, |
407 PP_URLComponents_Dev* components) OVERRIDE; | 422 PP_URLComponents_Dev* components) OVERRIDE; |
408 virtual PP_Var GetPluginInstanceURL( | 423 virtual PP_Var GetPluginInstanceURL( |
409 PP_Instance instance, | 424 PP_Instance instance, |
410 PP_URLComponents_Dev* components) OVERRIDE; | 425 PP_URLComponents_Dev* components) OVERRIDE; |
| 426 virtual void NeedKey(PP_Instance instance, |
| 427 PP_Var key_system, |
| 428 PP_Var session_id, |
| 429 PP_Resource init_data) OVERRIDE; |
| 430 virtual void KeyAdded(PP_Instance instance, |
| 431 PP_Var key_system, |
| 432 PP_Var session_id) OVERRIDE; |
| 433 virtual void KeyMessage(PP_Instance instance, |
| 434 PP_Var key_system, |
| 435 PP_Var session_id, |
| 436 PP_Resource message, |
| 437 PP_Var default_url) OVERRIDE; |
| 438 virtual void KeyError(PP_Instance instance, |
| 439 PP_Var key_system, |
| 440 PP_Var session_id, |
| 441 uint16_t media_error, |
| 442 uint16_t system_error) OVERRIDE; |
| 443 virtual void DeliverBlock(PP_Instance instance, |
| 444 PP_Resource decrypted_block, |
| 445 PP_CompletionCallback callback) OVERRIDE; |
| 446 virtual void DeliverFrame(PP_Instance instance, |
| 447 PP_Resource decrypted_frame, |
| 448 PP_CompletionCallback callback) OVERRIDE; |
| 449 virtual void DeliverSamples(PP_Instance instance, |
| 450 PP_Resource decrypted_samples, |
| 451 PP_CompletionCallback callback) OVERRIDE; |
411 | 452 |
412 // Reset this instance as proxied. Resets cached interfaces to point to the | 453 // Reset this instance as proxied. Resets cached interfaces to point to the |
413 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if | 454 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if |
414 // necessary). | 455 // necessary). |
415 // This is for use with the NaCl proxy. | 456 // This is for use with the NaCl proxy. |
416 bool ResetAsProxied(); | 457 bool ResetAsProxied(); |
417 | 458 |
418 private: | 459 private: |
419 // See the static Create functions above for creating PluginInstance objects. | 460 // See the static Create functions above for creating PluginInstance objects. |
420 // This constructor is private so that we can hide the PPP_Instance_Combined | 461 // This constructor is private so that we can hide the PPP_Instance_Combined |
421 // details while still having 1 constructor to maintain for member | 462 // details while still having 1 constructor to maintain for member |
422 // initialization. | 463 // initialization. |
423 PluginInstance(PluginDelegate* delegate, | 464 PluginInstance(PluginDelegate* delegate, |
424 PluginModule* module, | 465 PluginModule* module, |
425 ::ppapi::PPP_Instance_Combined* instance_interface); | 466 ::ppapi::PPP_Instance_Combined* instance_interface); |
426 | 467 |
| 468 bool LoadContentDecryptionModuleInterface(); |
427 bool LoadFindInterface(); | 469 bool LoadFindInterface(); |
428 bool LoadInputEventInterface(); | 470 bool LoadInputEventInterface(); |
429 bool LoadMessagingInterface(); | 471 bool LoadMessagingInterface(); |
430 bool LoadMouseLockInterface(); | 472 bool LoadMouseLockInterface(); |
431 bool LoadPdfInterface(); | 473 bool LoadPdfInterface(); |
432 bool LoadPrintInterface(); | 474 bool LoadPrintInterface(); |
433 bool LoadPrivateInterface(); | 475 bool LoadPrivateInterface(); |
434 bool LoadSelectionInterface(); | 476 bool LoadSelectionInterface(); |
435 bool LoadTextInputInterface(); | 477 bool LoadTextInputInterface(); |
436 bool LoadZoomInterface(); | 478 bool LoadZoomInterface(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 bool has_webkit_focus_; | 586 bool has_webkit_focus_; |
545 bool has_content_area_focus_; | 587 bool has_content_area_focus_; |
546 | 588 |
547 // The id of the current find operation, or -1 if none is in process. | 589 // The id of the current find operation, or -1 if none is in process. |
548 int find_identifier_; | 590 int find_identifier_; |
549 | 591 |
550 // Helper object that creates resources. | 592 // Helper object that creates resources. |
551 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; | 593 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; |
552 | 594 |
553 // The plugin-provided interfaces. | 595 // The plugin-provided interfaces. |
| 596 const PPP_ContentDecryptor_Dev* plugin_decryption_interface_; |
554 const PPP_Find_Dev* plugin_find_interface_; | 597 const PPP_Find_Dev* plugin_find_interface_; |
555 const PPP_InputEvent* plugin_input_event_interface_; | 598 const PPP_InputEvent* plugin_input_event_interface_; |
556 const PPP_Messaging* plugin_messaging_interface_; | 599 const PPP_Messaging* plugin_messaging_interface_; |
557 const PPP_MouseLock* plugin_mouse_lock_interface_; | 600 const PPP_MouseLock* plugin_mouse_lock_interface_; |
558 const PPP_Pdf* plugin_pdf_interface_; | 601 const PPP_Pdf* plugin_pdf_interface_; |
559 const PPP_Instance_Private* plugin_private_interface_; | 602 const PPP_Instance_Private* plugin_private_interface_; |
560 const PPP_Selection_Dev* plugin_selection_interface_; | 603 const PPP_Selection_Dev* plugin_selection_interface_; |
561 const PPP_TextInput_Dev* plugin_textinput_interface_; | 604 const PPP_TextInput_Dev* plugin_textinput_interface_; |
562 const PPP_Zoom_Dev* plugin_zoom_interface_; | 605 const PPP_Zoom_Dev* plugin_zoom_interface_; |
563 | 606 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 // the pointer so we can re-send it later if we are reset to talk to NaCl. | 719 // the pointer so we can re-send it later if we are reset to talk to NaCl. |
677 scoped_refptr<PPB_URLLoader_Impl> document_loader_; | 720 scoped_refptr<PPB_URLLoader_Impl> document_loader_; |
678 | 721 |
679 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 722 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
680 }; | 723 }; |
681 | 724 |
682 } // namespace ppapi | 725 } // namespace ppapi |
683 } // namespace webkit | 726 } // namespace webkit |
684 | 727 |
685 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 728 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |