| 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 CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 #include "ppapi/c/private/ppp_instance_private.h" | 50 #include "ppapi/c/private/ppp_instance_private.h" |
| 51 #include "ppapi/c/private/ppp_pdf.h" | 51 #include "ppapi/c/private/ppp_pdf.h" |
| 52 #include "ppapi/shared_impl/ppb_instance_shared.h" | 52 #include "ppapi/shared_impl/ppb_instance_shared.h" |
| 53 #include "ppapi/shared_impl/ppb_view_shared.h" | 53 #include "ppapi/shared_impl/ppb_view_shared.h" |
| 54 #include "ppapi/shared_impl/singleton_resource_id.h" | 54 #include "ppapi/shared_impl/singleton_resource_id.h" |
| 55 #include "ppapi/shared_impl/tracked_callback.h" | 55 #include "ppapi/shared_impl/tracked_callback.h" |
| 56 #include "ppapi/thunk/ppb_gamepad_api.h" | 56 #include "ppapi/thunk/ppb_gamepad_api.h" |
| 57 #include "ppapi/thunk/resource_creation_api.h" | 57 #include "ppapi/thunk/resource_creation_api.h" |
| 58 #include "third_party/WebKit/public/platform/WebCanvas.h" | 58 #include "third_party/WebKit/public/platform/WebCanvas.h" |
| 59 #include "third_party/WebKit/public/platform/WebString.h" | 59 #include "third_party/WebKit/public/platform/WebString.h" |
| 60 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | |
| 61 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 60 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 61 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h" |
| 62 #include "third_party/WebKit/public/web/WebPlugin.h" | 62 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 63 #include "third_party/WebKit/public/web/WebUserGestureToken.h" | 63 #include "third_party/WebKit/public/web/WebUserGestureToken.h" |
| 64 #include "ui/base/ime/text_input_type.h" | 64 #include "ui/base/ime/text_input_type.h" |
| 65 #include "ui/gfx/geometry/rect.h" | 65 #include "ui/gfx/geometry/rect.h" |
| 66 #include "url/gurl.h" | 66 #include "url/gurl.h" |
| 67 #include "v8/include/v8.h" | 67 #include "v8/include/v8.h" |
| 68 | 68 |
| 69 struct PP_Point; | 69 struct PP_Point; |
| 70 struct _NPP; | 70 struct _NPP; |
| 71 | 71 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 // Simulates an IME event at the level of RenderView which sends it back up to | 367 // Simulates an IME event at the level of RenderView which sends it back up to |
| 368 // the plugin as if it came from the user. | 368 // the plugin as if it came from the user. |
| 369 bool SimulateIMEEvent(const ppapi::InputEventData& input_event); | 369 bool SimulateIMEEvent(const ppapi::InputEventData& input_event); |
| 370 void SimulateImeSetCompositionEvent(const ppapi::InputEventData& input_event); | 370 void SimulateImeSetCompositionEvent(const ppapi::InputEventData& input_event); |
| 371 | 371 |
| 372 // The document loader is valid when the plugin is "full-frame" and in this | 372 // The document loader is valid when the plugin is "full-frame" and in this |
| 373 // case is non-NULL as long as the corresponding loader resource is alive. | 373 // case is non-NULL as long as the corresponding loader resource is alive. |
| 374 // This pointer is non-owning, so the loader must use set_document_loader to | 374 // This pointer is non-owning, so the loader must use set_document_loader to |
| 375 // clear itself when it is destroyed. | 375 // clear itself when it is destroyed. |
| 376 blink::WebURLLoaderClient* document_loader() const { | 376 blink::WebAssociatedURLLoaderClient* document_loader() const { |
| 377 return document_loader_; | 377 return document_loader_; |
| 378 } | 378 } |
| 379 void set_document_loader(blink::WebURLLoaderClient* loader) { | 379 void set_document_loader(blink::WebAssociatedURLLoaderClient* loader) { |
| 380 document_loader_ = loader; | 380 document_loader_ = loader; |
| 381 } | 381 } |
| 382 | 382 |
| 383 ContentDecryptorDelegate* GetContentDecryptorDelegate(); | 383 ContentDecryptorDelegate* GetContentDecryptorDelegate(); |
| 384 | 384 |
| 385 void SetGraphics2DTransform(const float& scale, | 385 void SetGraphics2DTransform(const float& scale, |
| 386 const gfx::PointF& translation); | 386 const gfx::PointF& translation); |
| 387 | 387 |
| 388 // PluginInstance implementation | 388 // PluginInstance implementation |
| 389 RenderFrame* GetRenderFrame() override; | 389 RenderFrame* GetRenderFrame() override; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 private: | 565 private: |
| 566 friend class base::RefCounted<PepperPluginInstanceImpl>; | 566 friend class base::RefCounted<PepperPluginInstanceImpl>; |
| 567 friend class PpapiPluginInstanceTest; | 567 friend class PpapiPluginInstanceTest; |
| 568 friend class PpapiUnittest; | 568 friend class PpapiUnittest; |
| 569 | 569 |
| 570 // Delete should be called by the WebPlugin before this destructor. | 570 // Delete should be called by the WebPlugin before this destructor. |
| 571 ~PepperPluginInstanceImpl() override; | 571 ~PepperPluginInstanceImpl() override; |
| 572 | 572 |
| 573 // Class to record document load notifications and play them back once the | 573 // Class to record document load notifications and play them back once the |
| 574 // real document loader becomes available. Used only by external instances. | 574 // real document loader becomes available. Used only by external instances. |
| 575 class ExternalDocumentLoader : public blink::WebURLLoaderClient { | 575 class ExternalDocumentLoader : public blink::WebAssociatedURLLoaderClient { |
| 576 public: | 576 public: |
| 577 ExternalDocumentLoader(); | 577 ExternalDocumentLoader(); |
| 578 ~ExternalDocumentLoader() override; | 578 ~ExternalDocumentLoader() override; |
| 579 | 579 |
| 580 void ReplayReceivedData(WebURLLoaderClient* document_loader); | 580 void ReplayReceivedData(WebAssociatedURLLoaderClient* document_loader); |
| 581 | 581 |
| 582 // blink::WebURLLoaderClient implementation. | 582 // blink::WebAssociatedURLLoaderClient implementation. |
| 583 void didReceiveData(blink::WebURLLoader* loader, | 583 void didReceiveData(const char* data, int data_length) override; |
| 584 const char* data, | 584 void didFinishLoading(double finish_time) override; |
| 585 int data_length, | 585 void didFail(const blink::WebURLError& error) override; |
| 586 int encoded_data_length, | |
| 587 int encoded_body_length) override; | |
| 588 void didFinishLoading(blink::WebURLLoader* loader, | |
| 589 double finish_time, | |
| 590 int64_t total_encoded_data_length) override; | |
| 591 void didFail(blink::WebURLLoader* loader, | |
| 592 const blink::WebURLError& error) override; | |
| 593 | 586 |
| 594 private: | 587 private: |
| 595 std::list<std::string> data_; | 588 std::list<std::string> data_; |
| 596 bool finished_loading_; | 589 bool finished_loading_; |
| 597 std::unique_ptr<blink::WebURLError> error_; | 590 std::unique_ptr<blink::WebURLError> error_; |
| 598 }; | 591 }; |
| 599 | 592 |
| 600 // Implements PPB_Gamepad_API. This is just to avoid having an excessive | 593 // Implements PPB_Gamepad_API. This is just to avoid having an excessive |
| 601 // number of interfaces implemented by PepperPluginInstanceImpl. | 594 // number of interfaces implemented by PepperPluginInstanceImpl. |
| 602 class GamepadImpl : public ppapi::thunk::PPB_Gamepad_API, | 595 class GamepadImpl : public ppapi::thunk::PPB_Gamepad_API, |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 // a user gesture after it has been processed. | 927 // a user gesture after it has been processed. |
| 935 PP_TimeTicks pending_user_gesture_; | 928 PP_TimeTicks pending_user_gesture_; |
| 936 blink::WebUserGestureToken pending_user_gesture_token_; | 929 blink::WebUserGestureToken pending_user_gesture_token_; |
| 937 | 930 |
| 938 // We store the arguments so we can re-send them if we are reset to talk to | 931 // We store the arguments so we can re-send them if we are reset to talk to |
| 939 // NaCl via the IPC NaCl proxy. | 932 // NaCl via the IPC NaCl proxy. |
| 940 std::vector<std::string> argn_; | 933 std::vector<std::string> argn_; |
| 941 std::vector<std::string> argv_; | 934 std::vector<std::string> argv_; |
| 942 | 935 |
| 943 // Non-owning pointer to the document loader, if any. | 936 // Non-owning pointer to the document loader, if any. |
| 944 blink::WebURLLoaderClient* document_loader_; | 937 blink::WebAssociatedURLLoaderClient* document_loader_; |
| 945 // State for deferring document loads. Used only by external instances. | 938 // State for deferring document loads. Used only by external instances. |
| 946 blink::WebURLResponse external_document_response_; | 939 blink::WebURLResponse external_document_response_; |
| 947 std::unique_ptr<ExternalDocumentLoader> external_document_loader_; | 940 std::unique_ptr<ExternalDocumentLoader> external_document_loader_; |
| 948 bool external_document_load_; | 941 bool external_document_load_; |
| 949 | 942 |
| 950 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private | 943 // The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private |
| 951 // calls and handles PPB_ContentDecryptor_Private calls. | 944 // calls and handles PPB_ContentDecryptor_Private calls. |
| 952 std::unique_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; | 945 std::unique_ptr<ContentDecryptorDelegate> content_decryptor_delegate_; |
| 953 | 946 |
| 954 // The link currently under the cursor. | 947 // The link currently under the cursor. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 // view change events. | 986 // view change events. |
| 994 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; | 987 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; |
| 995 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; | 988 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; |
| 996 | 989 |
| 997 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); | 990 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); |
| 998 }; | 991 }; |
| 999 | 992 |
| 1000 } // namespace content | 993 } // namespace content |
| 1001 | 994 |
| 1002 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 995 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| OLD | NEW |