| 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> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "ppapi/c/ppb_gamepad.h" | 33 #include "ppapi/c/ppb_gamepad.h" |
| 34 #include "ppapi/c/ppp_graphics_3d.h" | 34 #include "ppapi/c/ppp_graphics_3d.h" |
| 35 #include "ppapi/c/ppp_input_event.h" | 35 #include "ppapi/c/ppp_input_event.h" |
| 36 #include "ppapi/c/ppp_messaging.h" | 36 #include "ppapi/c/ppp_messaging.h" |
| 37 #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" | 38 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| 39 #include "ppapi/c/private/ppp_content_decryptor_private.h" | 39 #include "ppapi/c/private/ppp_content_decryptor_private.h" |
| 40 #include "ppapi/c/private/ppp_instance_private.h" | 40 #include "ppapi/c/private/ppp_instance_private.h" |
| 41 #include "ppapi/shared_impl/ppb_instance_shared.h" | 41 #include "ppapi/shared_impl/ppb_instance_shared.h" |
| 42 #include "ppapi/shared_impl/ppb_view_shared.h" | 42 #include "ppapi/shared_impl/ppb_view_shared.h" |
| 43 #include "ppapi/thunk/ppb_gamepad_api.h" |
| 43 #include "ppapi/thunk/resource_creation_api.h" | 44 #include "ppapi/thunk/resource_creation_api.h" |
| 44 #include "ppapi/shared_impl/tracked_callback.h" | 45 #include "ppapi/shared_impl/tracked_callback.h" |
| 45 #include "third_party/skia/include/core/SkRefCnt.h" | 46 #include "third_party/skia/include/core/SkRefCnt.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" | 47 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCanvas.h" |
| 47 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 48 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 48 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" | 49 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h" |
| 49 #include "ui/base/ime/text_input_type.h" | 50 #include "ui/base/ime/text_input_type.h" |
| 50 #include "ui/gfx/rect.h" | 51 #include "ui/gfx/rect.h" |
| 51 #include "webkit/plugins/ppapi/plugin_delegate.h" | 52 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 52 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 53 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // when not processing a user gesture or trying to set fullscreen when | 314 // when not processing a user gesture or trying to set fullscreen when |
| 314 // already in fullscreen mode). | 315 // already in fullscreen mode). |
| 315 bool SetFullscreen(bool fullscreen); | 316 bool SetFullscreen(bool fullscreen); |
| 316 | 317 |
| 317 // Implementation of PPB_Flash. | 318 // Implementation of PPB_Flash. |
| 318 int32_t Navigate(PPB_URLRequestInfo_Impl* request, | 319 int32_t Navigate(PPB_URLRequestInfo_Impl* request, |
| 319 const char* target, | 320 const char* target, |
| 320 bool from_user_action); | 321 bool from_user_action); |
| 321 bool IsRectTopmost(const gfx::Rect& rect); | 322 bool IsRectTopmost(const gfx::Rect& rect); |
| 322 | 323 |
| 323 // Implementation of PPB_Gamepad. | |
| 324 void SampleGamepads(PP_Instance instance, PP_GamepadsSampleData* data) | |
| 325 OVERRIDE; | |
| 326 | |
| 327 // Implementation of PPP_Messaging. | 324 // Implementation of PPP_Messaging. |
| 328 void HandleMessage(PP_Var message); | 325 void HandleMessage(PP_Var message); |
| 329 | 326 |
| 330 PluginDelegate::PlatformContext3D* CreateContext3D(); | 327 PluginDelegate::PlatformContext3D* CreateContext3D(); |
| 331 | 328 |
| 332 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe | 329 // Returns true iff the plugin is a full-page plugin (i.e. not in an iframe |
| 333 // or embedded in a page). | 330 // or embedded in a page). |
| 334 bool IsFullPagePlugin() const; | 331 bool IsFullPagePlugin() const; |
| 335 | 332 |
| 336 // Returns true if the plugin is processing a user gesture. | 333 // Returns true if the plugin is processing a user gesture. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 virtual void NumberOfFindResultsChanged(PP_Instance instance, | 369 virtual void NumberOfFindResultsChanged(PP_Instance instance, |
| 373 int32_t total, | 370 int32_t total, |
| 374 PP_Bool final_result) OVERRIDE; | 371 PP_Bool final_result) OVERRIDE; |
| 375 virtual void SelectedFindResultChanged(PP_Instance instance, | 372 virtual void SelectedFindResultChanged(PP_Instance instance, |
| 376 int32_t index) OVERRIDE; | 373 int32_t index) OVERRIDE; |
| 377 virtual PP_Bool SetFullscreen(PP_Instance instance, | 374 virtual PP_Bool SetFullscreen(PP_Instance instance, |
| 378 PP_Bool fullscreen) OVERRIDE; | 375 PP_Bool fullscreen) OVERRIDE; |
| 379 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) | 376 virtual PP_Bool GetScreenSize(PP_Instance instance, PP_Size* size) |
| 380 OVERRIDE; | 377 OVERRIDE; |
| 381 virtual ::ppapi::thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE; | 378 virtual ::ppapi::thunk::PPB_Flash_API* GetFlashAPI() OVERRIDE; |
| 379 virtual ::ppapi::thunk::PPB_Gamepad_API* GetGamepadAPI(PP_Instance instance) |
| 380 OVERRIDE; |
| 382 virtual int32_t RequestInputEvents(PP_Instance instance, | 381 virtual int32_t RequestInputEvents(PP_Instance instance, |
| 383 uint32_t event_classes) OVERRIDE; | 382 uint32_t event_classes) OVERRIDE; |
| 384 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, | 383 virtual int32_t RequestFilteringInputEvents(PP_Instance instance, |
| 385 uint32_t event_classes) OVERRIDE; | 384 uint32_t event_classes) OVERRIDE; |
| 386 virtual void ClearInputEventRequest(PP_Instance instance, | 385 virtual void ClearInputEventRequest(PP_Instance instance, |
| 387 uint32_t event_classes) OVERRIDE; | 386 uint32_t event_classes) OVERRIDE; |
| 388 virtual void ClosePendingUserGesture(PP_Instance instance, | 387 virtual void ClosePendingUserGesture(PP_Instance instance, |
| 389 PP_TimeTicks timestamp); | 388 PP_TimeTicks timestamp); |
| 390 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; | 389 virtual void ZoomChanged(PP_Instance instance, double factor) OVERRIDE; |
| 391 virtual void ZoomLimitsChanged(PP_Instance instance, | 390 virtual void ZoomLimitsChanged(PP_Instance instance, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 PP_Resource decrypted_samples, | 454 PP_Resource decrypted_samples, |
| 456 const PP_DecryptedBlockInfo* block_info) OVERRIDE; | 455 const PP_DecryptedBlockInfo* block_info) OVERRIDE; |
| 457 | 456 |
| 458 // Reset this instance as proxied. Resets cached interfaces to point to the | 457 // Reset this instance as proxied. Resets cached interfaces to point to the |
| 459 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if | 458 // proxy and re-sends DidCreate, DidChangeView, and HandleDocumentLoad (if |
| 460 // necessary). | 459 // necessary). |
| 461 // This is for use with the NaCl proxy. | 460 // This is for use with the NaCl proxy. |
| 462 bool ResetAsProxied(); | 461 bool ResetAsProxied(); |
| 463 | 462 |
| 464 private: | 463 private: |
| 464 // Implements PPB_Gamepad_API. This is just to avoid having an excessive |
| 465 // number of interfaces implemented by PluginInstance. |
| 466 class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API { |
| 467 public: |
| 468 GamepadImpl(PluginDelegate* delegate); |
| 469 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE; |
| 470 private: |
| 471 PluginDelegate* delegate_; |
| 472 }; |
| 473 |
| 465 // See the static Create functions above for creating PluginInstance objects. | 474 // See the static Create functions above for creating PluginInstance objects. |
| 466 // This constructor is private so that we can hide the PPP_Instance_Combined | 475 // This constructor is private so that we can hide the PPP_Instance_Combined |
| 467 // details while still having 1 constructor to maintain for member | 476 // details while still having 1 constructor to maintain for member |
| 468 // initialization. | 477 // initialization. |
| 469 PluginInstance(PluginDelegate* delegate, | 478 PluginInstance(PluginDelegate* delegate, |
| 470 PluginModule* module, | 479 PluginModule* module, |
| 471 ::ppapi::PPP_Instance_Combined* instance_interface); | 480 ::ppapi::PPP_Instance_Combined* instance_interface); |
| 472 | 481 |
| 473 bool LoadContentDecryptorInterface(); | 482 bool LoadContentDecryptorInterface(); |
| 474 bool LoadFindInterface(); | 483 bool LoadFindInterface(); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| | 644 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| |
| 636 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible | 645 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible |
| 637 // to generate the entire PDF given the variables below: | 646 // to generate the entire PDF given the variables below: |
| 638 // | 647 // |
| 639 // The most recently used WebCanvas, guaranteed to be valid. | 648 // The most recently used WebCanvas, guaranteed to be valid. |
| 640 SkRefPtr<WebKit::WebCanvas> canvas_; | 649 SkRefPtr<WebKit::WebCanvas> canvas_; |
| 641 // An array of page ranges. | 650 // An array of page ranges. |
| 642 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 651 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
| 643 #endif // OS_LINUX || OS_WIN | 652 #endif // OS_LINUX || OS_WIN |
| 644 | 653 |
| 654 GamepadImpl gamepad_impl_; |
| 655 |
| 645 // The plugin print interface. | 656 // The plugin print interface. |
| 646 const PPP_Printing_Dev* plugin_print_interface_; | 657 const PPP_Printing_Dev* plugin_print_interface_; |
| 647 | 658 |
| 648 // The plugin 3D interface. | 659 // The plugin 3D interface. |
| 649 const PPP_Graphics3D* plugin_graphics_3d_interface_; | 660 const PPP_Graphics3D* plugin_graphics_3d_interface_; |
| 650 | 661 |
| 651 // Contains the cursor if it's set by the plugin. | 662 // Contains the cursor if it's set by the plugin. |
| 652 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 663 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
| 653 | 664 |
| 654 // Set to true if this plugin thinks it will always be on top. This allows us | 665 // Set to true if this plugin thinks it will always be on top. This allows us |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 // the pointer so we can re-send it later if we are reset to talk to NaCl. | 739 // the pointer so we can re-send it later if we are reset to talk to NaCl. |
| 729 scoped_refptr<PPB_URLLoader_Impl> document_loader_; | 740 scoped_refptr<PPB_URLLoader_Impl> document_loader_; |
| 730 | 741 |
| 731 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 742 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 732 }; | 743 }; |
| 733 | 744 |
| 734 } // namespace ppapi | 745 } // namespace ppapi |
| 735 } // namespace webkit | 746 } // namespace webkit |
| 736 | 747 |
| 737 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 748 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |