Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(742)

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.h

Issue 14371021: Implementation of URLLoader using PluginResource/ResourceHost. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add DocumentLoader class to record document load events. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/ppapi_plugin_instance.h
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 281b8d42eb4d61bb075f07ba28bb7f3c6fae4de9..ae1da1756efa23f78f03a476592839c3acf28aeb 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -46,6 +46,8 @@
#include "ppapi/thunk/resource_creation_api.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebCanvas.h"
#include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebURLLoaderClient.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebURLResponse.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPlugin.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebUserGestureToken.h"
#include "third_party/skia/include/core/SkRefCnt.h"
@@ -65,8 +67,11 @@ class WebInputEvent;
class WebLayer;
class WebMouseEvent;
class WebPluginContainer;
+class WebURLLoader;
+class WebURLResponse;
struct WebCompositionUnderline;
struct WebCursorInfo;
+struct WebURLError;
struct WebPrintParams;
}
@@ -131,6 +136,10 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// nonzero.
PP_Instance pp_instance() const { return pp_instance_; }
+ ::ppapi::PPP_Instance_Combined* instance_interface() const {
+ return instance_interface_.get();
+ }
+
::ppapi::thunk::ResourceCreationAPI& resource_creation() {
return *resource_creation_.get();
}
@@ -173,11 +182,11 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
bool full_frame() const { return full_frame_; }
const ::ppapi::ViewData& view_data() const { return view_data_; }
- // PPP_Instance and PPP_Instance_Private pass-through.
+ // PPP_Instance and PPP_Instance_Private.
bool Initialize(const std::vector<std::string>& arg_names,
const std::vector<std::string>& arg_values,
bool full_frame);
- bool HandleDocumentLoad(PPB_URLLoader_Impl* loader);
+ bool HandleDocumentLoad(const WebKit::WebURLResponse& response);
bool HandleInputEvent(const WebKit::WebInputEvent& event,
WebKit::WebCursorInfo* cursor_info);
PP_Var GetInstanceObject();
@@ -352,6 +361,17 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
void SimulateImeSetCompositionEvent(
const ::ppapi::InputEventData& input_event);
+ // The document loader is valid when the plugin is "full-frame" and in this
+ // case is non-NULL as long as the corresponding loader resource is alive.
+ // This pointer is non-owning, so the loader must use set_document_loader to
+ // clear itself when it is destroyed.
+ WebKit::WebURLLoaderClient* document_loader() const {
+ return document_loader_;
+ }
+ void set_document_loader(WebKit::WebURLLoaderClient* loader) {
+ document_loader_ = loader;
+ }
+
ContentDecryptorDelegate* GetContentDecryptorDelegate();
// PPB_Instance_API implementation.
@@ -485,6 +505,31 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
private:
friend class PpapiUnittest;
+ // Class to record document load notifications and play them back once the
+ // real document loader becomes available. Used only by NaCl instances.
+ class NaClDocumentLoader : public WebKit::WebURLLoaderClient {
+ public:
+ NaClDocumentLoader();
+ virtual ~NaClDocumentLoader();
+
+ void ReplayReceivedData(WebURLLoaderClient* document_loader);
+
+ // WebKit::WebURLLoaderClient implementation.
+ virtual void didReceiveData(WebKit::WebURLLoader* loader,
+ const char* data,
+ int data_length,
+ int encoded_data_length);
+ virtual void didFinishLoading(WebKit::WebURLLoader* loader,
+ double finish_time);
+ virtual void didFail(WebKit::WebURLLoader* loader,
+ const WebKit::WebURLError& error);
+
+ private:
+ std::list<std::string> data_;
+ bool finished_loading_;
+ scoped_ptr<WebKit::WebURLError> error_;
+ };
+
// Implements PPB_Gamepad_API. This is just to avoid having an excessive
// number of interfaces implemented by PluginInstance.
class GamepadImpl : public ::ppapi::thunk::PPB_Gamepad_API,
@@ -778,9 +823,12 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
std::vector<std::string> argn_;
std::vector<std::string> argv_;
- // This is NULL unless HandleDocumentLoad has called. In that case, we store
- // the pointer so we can re-send it later if we are reset to talk to NaCl.
- scoped_refptr<PPB_URLLoader_Impl> document_loader_;
+ // Non-owning pointer to the document loader, if any.
+ WebKit::WebURLLoaderClient* document_loader_;
+ // State for deferring document loads. Used only by NaCl instances.
+ WebKit::WebURLResponse nacl_document_response_;
+ scoped_ptr<NaClDocumentLoader> nacl_document_loader_;
+ bool nacl_document_load_;
// The ContentDecryptorDelegate forwards PPP_ContentDecryptor_Private
// calls and handles PPB_ContentDecryptor_Private calls.

Powered by Google App Engine
This is Rietveld 408576698