| 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 <map> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 18 #include "base/string16.h" | 19 #include "base/string16.h" |
| 19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
| 21 #include "media/base/decryptor.h" |
| 20 #include "ppapi/c/dev/pp_cursor_type_dev.h" | 22 #include "ppapi/c/dev/pp_cursor_type_dev.h" |
| 21 #include "ppapi/c/dev/ppp_printing_dev.h" | 23 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 22 #include "ppapi/c/dev/ppp_find_dev.h" | 24 #include "ppapi/c/dev/ppp_find_dev.h" |
| 23 #include "ppapi/c/dev/ppp_selection_dev.h" | 25 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 24 #include "ppapi/c/dev/ppp_text_input_dev.h" | 26 #include "ppapi/c/dev/ppp_text_input_dev.h" |
| 25 #include "ppapi/c/dev/ppp_zoom_dev.h" | 27 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 26 #include "ppapi/c/pp_completion_callback.h" | 28 #include "ppapi/c/pp_completion_callback.h" |
| 27 #include "ppapi/c/pp_instance.h" | 29 #include "ppapi/c/pp_instance.h" |
| 28 #include "ppapi/c/pp_resource.h" | 30 #include "ppapi/c/pp_resource.h" |
| 29 #include "ppapi/c/pp_time.h" | 31 #include "ppapi/c/pp_time.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 64 |
| 63 namespace WebKit { | 65 namespace WebKit { |
| 64 class WebInputEvent; | 66 class WebInputEvent; |
| 65 class WebMouseEvent; | 67 class WebMouseEvent; |
| 66 class WebPluginContainer; | 68 class WebPluginContainer; |
| 67 struct WebCompositionUnderline; | 69 struct WebCompositionUnderline; |
| 68 struct WebCursorInfo; | 70 struct WebCursorInfo; |
| 69 struct WebPrintParams; | 71 struct WebPrintParams; |
| 70 } | 72 } |
| 71 | 73 |
| 74 namespace media { |
| 75 class DecoderBuffer; |
| 76 class DecryptorClient; |
| 77 } |
| 78 |
| 72 namespace ppapi { | 79 namespace ppapi { |
| 73 struct InputEventData; | 80 struct InputEventData; |
| 74 struct PPP_Instance_Combined; | 81 struct PPP_Instance_Combined; |
| 75 class Resource; | 82 class Resource; |
| 76 } | 83 } |
| 77 | 84 |
| 78 namespace ui { | 85 namespace ui { |
| 79 class Range; | 86 class Range; |
| 80 } | 87 } |
| 81 | 88 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); | 243 bool PrintPage(int page_number, WebKit::WebCanvas* canvas); |
| 237 void PrintEnd(); | 244 void PrintEnd(); |
| 238 | 245 |
| 239 bool CanRotateView(); | 246 bool CanRotateView(); |
| 240 void RotateView(WebKit::WebPlugin::RotationType type); | 247 void RotateView(WebKit::WebPlugin::RotationType type); |
| 241 | 248 |
| 242 void Graphics3DContextLost(); | 249 void Graphics3DContextLost(); |
| 243 | 250 |
| 244 // Provides access to PPP_ContentDecryptor_Private. | 251 // Provides access to PPP_ContentDecryptor_Private. |
| 245 // TODO(tomfinegan): Move decryptor methods to delegate class. | 252 // TODO(tomfinegan): Move decryptor methods to delegate class. |
| 246 typedef base::Callback<void(void*, int)> DecryptedDataCB; | 253 void set_decrypt_client(media::DecryptorClient* client); |
| 247 bool GenerateKeyRequest(const std::string& key_system, | 254 bool GenerateKeyRequest(const std::string& key_system, |
| 248 const std::string& init_data); | 255 const std::string& init_data); |
| 249 bool AddKey(const std::string& session_id, | 256 bool AddKey(const std::string& session_id, |
| 250 const std::string& key, | 257 const std::string& key, |
| 251 const std::string& init_data); | 258 const std::string& init_data); |
| 252 bool CancelKeyRequest(const std::string& session_id); | 259 bool CancelKeyRequest(const std::string& session_id); |
| 253 bool Decrypt(const base::StringPiece& encypted_block, | 260 bool Decrypt(const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 254 const DecryptedDataCB& callback); | 261 const media::Decryptor::DecryptCB& decrypt_cb); |
| 255 bool DecryptAndDecode(const base::StringPiece& encypted_block, | 262 // TODO(xhwang): Update this when we need to support decrypt and decode. |
| 256 const DecryptedDataCB& callback); | 263 bool DecryptAndDecode( |
| 264 const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, |
| 265 const media::Decryptor::DecryptCB& decrypt_cb); |
| 257 | 266 |
| 258 // There are 2 implementations of the fullscreen interface | 267 // There are 2 implementations of the fullscreen interface |
| 259 // PPB_FlashFullscreen is used by Pepper Flash. | 268 // PPB_FlashFullscreen is used by Pepper Flash. |
| 260 // PPB_Fullscreen is intended for other applications including NaCl. | 269 // PPB_Fullscreen is intended for other applications including NaCl. |
| 261 // The two interface are mutually exclusive. | 270 // The two interface are mutually exclusive. |
| 262 | 271 |
| 263 // Implementation of PPB_FlashFullscreen. | 272 // Implementation of PPB_FlashFullscreen. |
| 264 | 273 |
| 265 // Because going to fullscreen is asynchronous (but going out is not), there | 274 // Because going to fullscreen is asynchronous (but going out is not), there |
| 266 // are 3 states: | 275 // are 3 states: |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // or embedded in a page). | 339 // or embedded in a page). |
| 331 bool IsFullPagePlugin() const; | 340 bool IsFullPagePlugin() const; |
| 332 | 341 |
| 333 // Returns true if the plugin is processing a user gesture. | 342 // Returns true if the plugin is processing a user gesture. |
| 334 bool IsProcessingUserGesture(); | 343 bool IsProcessingUserGesture(); |
| 335 | 344 |
| 336 // A mouse lock request was pending and this reports success or failure. | 345 // A mouse lock request was pending and this reports success or failure. |
| 337 void OnLockMouseACK(bool succeeded); | 346 void OnLockMouseACK(bool succeeded); |
| 338 // A mouse lock was in place, but has been lost. | 347 // A mouse lock was in place, but has been lost. |
| 339 void OnMouseLockLost(); | 348 void OnMouseLockLost(); |
| 340 // A mouse lock is enabled and mouse events are being delievered. | 349 // A mouse lock is enabled and mouse events are being delivered. |
| 341 void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); | 350 void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); |
| 342 | 351 |
| 343 // Simulates an input event to the plugin by passing it down to WebKit, | 352 // Simulates an input event to the plugin by passing it down to WebKit, |
| 344 // which sends it back up to the plugin as if it came from the user. | 353 // which sends it back up to the plugin as if it came from the user. |
| 345 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); | 354 void SimulateInputEvent(const ::ppapi::InputEventData& input_event); |
| 346 | 355 |
| 347 // Simulates an IME event at the level of RenderView which sends it back up to | 356 // Simulates an IME event at the level of RenderView which sends it back up to |
| 348 // the plugin as if it came from the user. | 357 // the plugin as if it came from the user. |
| 349 bool SimulateIMEEvent(const ::ppapi::InputEventData& input_event); | 358 bool SimulateIMEEvent(const ::ppapi::InputEventData& input_event); |
| 350 void SimulateImeSetCompositionEvent( | 359 void SimulateImeSetCompositionEvent( |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if | 467 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if |
| 459 // necessary). | 468 // necessary). |
| 460 // This is for use with the NaCl proxy. | 469 // This is for use with the NaCl proxy. |
| 461 bool ResetAsProxied(); | 470 bool ResetAsProxied(); |
| 462 | 471 |
| 463 private: | 472 private: |
| 464 // Implements PPB_Gamepad_API. This is just to avoid having an excessive | 473 // Implements PPB_Gamepad_API. This is just to avoid having an excessive |
| 465 // number of interfaces implemented by PluginInstance. | 474 // number of interfaces implemented by PluginInstance. |
| 466 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API { | 475 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API { |
| 467 public: | 476 public: |
| 468 GamepadImpl(PluginDelegate* delegate); | 477 explicit GamepadImpl(PluginDelegate* delegate); |
| 469 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE; | 478 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE; |
| 470 private: | 479 private: |
| 471 PluginDelegate* delegate_; | 480 PluginDelegate* delegate_; |
| 472 }; | 481 }; |
| 473 | 482 |
| 474 // See the static Create functions above for creating PluginInstance objects. | 483 // See the static Create functions above for creating PluginInstance objects. |
| 475 // This constructor is private so that we can hide the PPP_Instance_Combined | 484 // This constructor is private so that we can hide the PPP_Instance_Combined |
| 476 // details while still having 1 constructor to maintain for member | 485 // details while still having 1 constructor to maintain for member |
| 477 // initialization. | 486 // initialization. |
| 478 PluginInstance(PluginDelegate* delegate, | 487 PluginInstance(PluginDelegate* delegate, |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 | 741 |
| 733 // We store the arguments so we can re-send them if we are reset to talk to | 742 // We store the arguments so we can re-send them if we are reset to talk to |
| 734 // NaCl via the IPC NaCl proxy. | 743 // NaCl via the IPC NaCl proxy. |
| 735 std::vector<std::string> argn_; | 744 std::vector<std::string> argn_; |
| 736 std::vector<std::string> argv_; | 745 std::vector<std::string> argv_; |
| 737 | 746 |
| 738 // This is NULL unless HandleDocumentLoad has called. In that case, we store | 747 // This is NULL unless HandleDocumentLoad has called. In that case, we store |
| 739 // the pointer so we can re-send it later if we are reset to talk to NaCl. | 748 // the pointer so we can re-send it later if we are reset to talk to NaCl. |
| 740 scoped_refptr<PPB_URLLoader_Impl> document_loader_; | 749 scoped_refptr<PPB_URLLoader_Impl> document_loader_; |
| 741 | 750 |
| 751 media::DecryptorClient* decryptor_client_; |
| 752 uint32_t next_decryption_request_id_; |
| 753 typedef std::map<uint32_t, media::Decryptor::DecryptCB> DecryptionCBMap; |
| 754 DecryptionCBMap pending_decryption_cbs_; |
| 755 |
| 742 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 756 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 743 }; | 757 }; |
| 744 | 758 |
| 745 } // namespace ppapi | 759 } // namespace ppapi |
| 746 } // namespace webkit | 760 } // namespace webkit |
| 747 | 761 |
| 748 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 762 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |