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. | |
xhwang
2012/08/15 00:27:57
dmichael@ mentioned moving these to a delegate cla
xhwang
2012/08/15 00:27:57
dmichael@ mentioned moving these to a delegate cla
Tom Finegan
2012/08/16 03:10:48
Done.
| |
243 typedef base::Callback<void(void*, int)> DecryptedDataCB; | |
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 base::StringPiece& encypted_block, | |
xhwang
2012/08/15 00:27:57
FYI: this is okay for now, later on this will be r
| |
250 const DecryptedDataCB& callback); | |
251 bool DecryptAndDecode(const base::StringPiece& encypted_block, | |
252 const DecryptedDataCB& 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, | |
xhwang
2012/08/15 00:27:57
ditto about moving into a delegate class.
Tom Finegan
2012/08/16 03:10:48
Done.
| |
427 PP_Var key_system, | |
428 PP_Var session_id, | |
429 PP_Var 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 int32_t media_error, | |
442 int32_t system_code) OVERRIDE; | |
443 virtual void DeliverBlock(PP_Instance instance, | |
444 PP_Resource decrypted_block, | |
445 int32_t request_id) OVERRIDE; | |
446 virtual void DeliverFrame(PP_Instance instance, | |
447 PP_Resource decrypted_frame, | |
448 int32_t request_id) OVERRIDE; | |
449 virtual void DeliverSamples(PP_Instance instance, | |
450 PP_Resource decrypted_samples, | |
451 int32_t request_id) 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 LoadContentDecryptorInterface(); | |
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 bool has_webkit_focus_; | 590 bool has_webkit_focus_; |
549 bool has_content_area_focus_; | 591 bool has_content_area_focus_; |
550 | 592 |
551 // The id of the current find operation, or -1 if none is in process. | 593 // The id of the current find operation, or -1 if none is in process. |
552 int find_identifier_; | 594 int find_identifier_; |
553 | 595 |
554 // Helper object that creates resources. | 596 // Helper object that creates resources. |
555 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; | 597 scoped_ptr< ::ppapi::thunk::ResourceCreationAPI> resource_creation_; |
556 | 598 |
557 // The plugin-provided interfaces. | 599 // The plugin-provided interfaces. |
600 const PPP_ContentDecryptor_Private* plugin_decryption_interface_; | |
558 const PPP_Find_Dev* plugin_find_interface_; | 601 const PPP_Find_Dev* plugin_find_interface_; |
559 const PPP_InputEvent* plugin_input_event_interface_; | 602 const PPP_InputEvent* plugin_input_event_interface_; |
560 const PPP_Messaging* plugin_messaging_interface_; | 603 const PPP_Messaging* plugin_messaging_interface_; |
561 const PPP_MouseLock* plugin_mouse_lock_interface_; | 604 const PPP_MouseLock* plugin_mouse_lock_interface_; |
562 const PPP_Pdf* plugin_pdf_interface_; | 605 const PPP_Pdf* plugin_pdf_interface_; |
563 const PPP_Instance_Private* plugin_private_interface_; | 606 const PPP_Instance_Private* plugin_private_interface_; |
564 const PPP_Selection_Dev* plugin_selection_interface_; | 607 const PPP_Selection_Dev* plugin_selection_interface_; |
565 const PPP_TextInput_Dev* plugin_textinput_interface_; | 608 const PPP_TextInput_Dev* plugin_textinput_interface_; |
566 const PPP_Zoom_Dev* plugin_zoom_interface_; | 609 const PPP_Zoom_Dev* plugin_zoom_interface_; |
567 | 610 |
(...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. | 723 // 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_; | 724 scoped_refptr<PPB_URLLoader_Impl> document_loader_; |
682 | 725 |
683 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 726 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
684 }; | 727 }; |
685 | 728 |
686 } // namespace ppapi | 729 } // namespace ppapi |
687 } // namespace webkit | 730 } // namespace webkit |
688 | 731 |
689 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 732 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |