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" |
20 #include "ppapi/c/dev/ppp_printing_dev.h" | 21 #include "ppapi/c/dev/ppp_printing_dev.h" |
21 #include "ppapi/c/dev/ppp_find_dev.h" | 22 #include "ppapi/c/dev/ppp_find_dev.h" |
22 #include "ppapi/c/dev/ppp_selection_dev.h" | 23 #include "ppapi/c/dev/ppp_selection_dev.h" |
23 #include "ppapi/c/dev/ppp_text_input_dev.h" | 24 #include "ppapi/c/dev/ppp_text_input_dev.h" |
24 #include "ppapi/c/dev/ppp_zoom_dev.h" | 25 #include "ppapi/c/dev/ppp_zoom_dev.h" |
25 #include "ppapi/c/pp_completion_callback.h" | 26 #include "ppapi/c/pp_completion_callback.h" |
26 #include "ppapi/c/pp_instance.h" | 27 #include "ppapi/c/pp_instance.h" |
27 #include "ppapi/c/pp_resource.h" | 28 #include "ppapi/c/pp_resource.h" |
28 #include "ppapi/c/pp_time.h" | 29 #include "ppapi/c/pp_time.h" |
29 #include "ppapi/c/pp_var.h" | 30 #include "ppapi/c/pp_var.h" |
30 #include "ppapi/c/ppb_audio_config.h" | 31 #include "ppapi/c/ppb_audio_config.h" |
31 #include "ppapi/c/ppb_input_event.h" | 32 #include "ppapi/c/ppb_input_event.h" |
32 #include "ppapi/c/ppb_gamepad.h" | 33 #include "ppapi/c/ppb_gamepad.h" |
33 #include "ppapi/c/ppp_graphics_3d.h" | 34 #include "ppapi/c/ppp_graphics_3d.h" |
34 #include "ppapi/c/ppp_input_event.h" | 35 #include "ppapi/c/ppp_input_event.h" |
35 #include "ppapi/c/ppp_messaging.h" | 36 #include "ppapi/c/ppp_messaging.h" |
36 #include "ppapi/c/ppp_mouse_lock.h" | 37 #include "ppapi/c/ppp_mouse_lock.h" |
| 38 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| 39 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
37 #include "ppapi/c/private/ppp_instance_private.h" | 40 #include "ppapi/c/private/ppp_instance_private.h" |
38 #include "ppapi/shared_impl/ppb_instance_shared.h" | 41 #include "ppapi/shared_impl/ppb_instance_shared.h" |
39 #include "ppapi/shared_impl/ppb_view_shared.h" | 42 #include "ppapi/shared_impl/ppb_view_shared.h" |
40 #include "ppapi/thunk/resource_creation_api.h" | 43 #include "ppapi/thunk/resource_creation_api.h" |
41 #include "ppapi/shared_impl/tracked_callback.h" | 44 #include "ppapi/shared_impl/tracked_callback.h" |
42 #include "third_party/skia/include/core/SkRefCnt.h" | 45 #include "third_party/skia/include/core/SkRefCnt.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
46 #include "ui/base/ime/text_input_type.h" | 49 #include "ui/base/ime/text_input_type.h" |
(...skipping 182 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_Private. |
| 243 // TODO(tomfinegan): Move decryptor methods to delegate class. |
| 244 typedef base::Callback<void(void*, int)> DecryptedDataCB; |
| 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 base::StringPiece& encypted_block, |
| 251 const DecryptedDataCB& callback); |
| 252 bool DecryptAndDecode(const base::StringPiece& encypted_block, |
| 253 const DecryptedDataCB& callback); |
| 254 |
239 // There are 2 implementations of the fullscreen interface | 255 // There are 2 implementations of the fullscreen interface |
240 // PPB_FlashFullscreen is used by Pepper Flash. | 256 // PPB_FlashFullscreen is used by Pepper Flash. |
241 // PPB_Fullscreen is intended for other applications including NaCl. | 257 // PPB_Fullscreen is intended for other applications including NaCl. |
242 // The two interface are mutually exclusive. | 258 // The two interface are mutually exclusive. |
243 | 259 |
244 // Implementation of PPB_FlashFullscreen. | 260 // Implementation of PPB_FlashFullscreen. |
245 | 261 |
246 // 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 |
247 // are 3 states: | 263 // are 3 states: |
248 // - normal : fullscreen_container_ == NULL | 264 // - normal : fullscreen_container_ == NULL |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 PP_URLComponents_Dev* components) OVERRIDE; | 418 PP_URLComponents_Dev* components) OVERRIDE; |
403 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; | 419 virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) OVERRIDE; |
404 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, | 420 virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance, |
405 PP_Instance target) OVERRIDE; | 421 PP_Instance target) OVERRIDE; |
406 virtual PP_Var GetDocumentURL(PP_Instance instance, | 422 virtual PP_Var GetDocumentURL(PP_Instance instance, |
407 PP_URLComponents_Dev* components) OVERRIDE; | 423 PP_URLComponents_Dev* components) OVERRIDE; |
408 virtual PP_Var GetPluginInstanceURL( | 424 virtual PP_Var GetPluginInstanceURL( |
409 PP_Instance instance, | 425 PP_Instance instance, |
410 PP_URLComponents_Dev* components) OVERRIDE; | 426 PP_URLComponents_Dev* components) OVERRIDE; |
411 | 427 |
| 428 // TODO(tomfinegan): Move the next 7 methods to a delegate class. |
| 429 virtual void NeedKey(PP_Instance instance, |
| 430 PP_Var key_system, |
| 431 PP_Var session_id, |
| 432 PP_Var init_data) OVERRIDE; |
| 433 virtual void KeyAdded(PP_Instance instance, |
| 434 PP_Var key_system, |
| 435 PP_Var session_id) OVERRIDE; |
| 436 virtual void KeyMessage(PP_Instance instance, |
| 437 PP_Var key_system, |
| 438 PP_Var session_id, |
| 439 PP_Resource message, |
| 440 PP_Var default_url) OVERRIDE; |
| 441 virtual void KeyError(PP_Instance instance, |
| 442 PP_Var key_system, |
| 443 PP_Var session_id, |
| 444 int32_t media_error, |
| 445 int32_t system_code) OVERRIDE; |
| 446 virtual void DeliverBlock(PP_Instance instance, |
| 447 PP_Resource decrypted_block, |
| 448 int32_t request_id) OVERRIDE; |
| 449 virtual void DeliverFrame(PP_Instance instance, |
| 450 PP_Resource decrypted_frame, |
| 451 int32_t request_id) OVERRIDE; |
| 452 virtual void DeliverSamples(PP_Instance instance, |
| 453 PP_Resource decrypted_samples, |
| 454 int32_t request_id) OVERRIDE; |
| 455 |
412 // Reset this instance as proxied. Resets cached interfaces to point to the | 456 // Reset this instance as proxied. Resets cached interfaces to point to the |
413 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if | 457 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if |
414 // necessary). | 458 // necessary). |
415 // This is for use with the NaCl proxy. | 459 // This is for use with the NaCl proxy. |
416 bool ResetAsProxied(); | 460 bool ResetAsProxied(); |
417 | 461 |
418 private: | 462 private: |
419 // See the static Create functions above for creating PluginInstance objects. | 463 // See the static Create functions above for creating PluginInstance objects. |
420 // This constructor is private so that we can hide the PPP_Instance_Combined | 464 // This constructor is private so that we can hide the PPP_Instance_Combined |
421 // details while still having 1 constructor to maintain for member | 465 // details while still having 1 constructor to maintain for member |
422 // initialization. | 466 // initialization. |
423 PluginInstance(PluginDelegate* delegate, | 467 PluginInstance(PluginDelegate* delegate, |
424 PluginModule* module, | 468 PluginModule* module, |
425 ::ppapi::PPP_Instance_Combined* instance_interface); | 469 ::ppapi::PPP_Instance_Combined* instance_interface); |
426 | 470 |
| 471 bool LoadContentDecryptorInterface(); |
427 bool LoadFindInterface(); | 472 bool LoadFindInterface(); |
428 bool LoadInputEventInterface(); | 473 bool LoadInputEventInterface(); |
429 bool LoadMessagingInterface(); | 474 bool LoadMessagingInterface(); |
430 bool LoadMouseLockInterface(); | 475 bool LoadMouseLockInterface(); |
431 bool LoadPdfInterface(); | 476 bool LoadPdfInterface(); |
432 bool LoadPrintInterface(); | 477 bool LoadPrintInterface(); |
433 bool LoadPrivateInterface(); | 478 bool LoadPrivateInterface(); |
434 bool LoadSelectionInterface(); | 479 bool LoadSelectionInterface(); |
435 bool LoadTextInputInterface(); | 480 bool LoadTextInputInterface(); |
436 bool LoadZoomInterface(); | 481 bool LoadZoomInterface(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 bool has_webkit_focus_; | 593 bool has_webkit_focus_; |
549 bool has_content_area_focus_; | 594 bool has_content_area_focus_; |
550 | 595 |
551 // The id of the current find operation, or -1 if none is in process. | 596 // The id of the current find operation, or -1 if none is in process. |
552 int find_identifier_; | 597 int find_identifier_; |
553 | 598 |
554 // Helper object that creates resources. | 599 // Helper object that creates resources. |
555 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; | 600 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; |
556 | 601 |
557 // The plugin-provided interfaces. | 602 // The plugin-provided interfaces. |
| 603 const PPP_ContentDecryptor_Private* plugin_decryption_interface_; |
558 const PPP_Find_Dev* plugin_find_interface_; | 604 const PPP_Find_Dev* plugin_find_interface_; |
559 const PPP_InputEvent* plugin_input_event_interface_; | 605 const PPP_InputEvent* plugin_input_event_interface_; |
560 const PPP_Messaging* plugin_messaging_interface_; | 606 const PPP_Messaging* plugin_messaging_interface_; |
561 const PPP_MouseLock* plugin_mouse_lock_interface_; | 607 const PPP_MouseLock* plugin_mouse_lock_interface_; |
562 const PPP_Pdf* plugin_pdf_interface_; | 608 const PPP_Pdf* plugin_pdf_interface_; |
563 const PPP_Instance_Private* plugin_private_interface_; | 609 const PPP_Instance_Private* plugin_private_interface_; |
564 const PPP_Selection_Dev* plugin_selection_interface_; | 610 const PPP_Selection_Dev* plugin_selection_interface_; |
565 const PPP_TextInput_Dev* plugin_textinput_interface_; | 611 const PPP_TextInput_Dev* plugin_textinput_interface_; |
566 const PPP_Zoom_Dev* plugin_zoom_interface_; | 612 const PPP_Zoom_Dev* plugin_zoom_interface_; |
567 | 613 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 // the pointer so we can re-send it later if we are reset to talk to NaCl. | 726 // the pointer so we can re-send it later if we are reset to talk to NaCl. |
681 scoped_refptr<PPB_URLLoader_Impl> document_loader_; | 727 scoped_refptr<PPB_URLLoader_Impl> document_loader_; |
682 | 728 |
683 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 729 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
684 }; | 730 }; |
685 | 731 |
686 } // namespace ppapi | 732 } // namespace ppapi |
687 } // namespace webkit | 733 } // namespace webkit |
688 | 734 |
689 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 735 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |