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

Unified Diff: webkit/glue/plugins/pepper_url_request_info.cc

Issue 2861036: Add basic Pepper URLLoader implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « webkit/glue/plugins/pepper_url_request_info.h ('k') | webkit/glue/resource_loader_bridge.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/plugins/pepper_url_request_info.cc
===================================================================
--- webkit/glue/plugins/pepper_url_request_info.cc (revision 51226)
+++ webkit/glue/plugins/pepper_url_request_info.cc (working copy)
@@ -5,11 +5,16 @@
#include "webkit/glue/plugins/pepper_url_request_info.h"
#include "base/logging.h"
+#include "googleurl/src/gurl.h"
#include "third_party/ppapi/c/pp_var.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
+#include "webkit/glue/plugins/pepper_file_ref.h"
#include "webkit/glue/plugins/pepper_plugin_module.h"
#include "webkit/glue/plugins/pepper_string.h"
#include "webkit/glue/plugins/pepper_var.h"
+using WebKit::WebString;
+
namespace pepper {
namespace {
@@ -64,8 +69,19 @@
int64_t start_offset,
int64_t number_of_bytes,
PP_Time expected_last_modified_time) {
- NOTIMPLEMENTED(); // TODO(darin): Implement me!
- return false;
+ scoped_refptr<URLRequestInfo> request(
+ Resource::GetAs<URLRequestInfo>(request_id));
+ if (!request.get())
+ return false;
+
+ scoped_refptr<FileRef> file_ref(Resource::GetAs<FileRef>(file_ref_id));
+ if (!file_ref.get())
+ return false;
+
+ return request->AppendFileToBody(file_ref,
+ start_offset,
+ number_of_bytes,
+ expected_last_modified_time);
}
const PPB_URLRequestInfo ppb_urlrequestinfo = {
@@ -80,6 +96,7 @@
URLRequestInfo::URLRequestInfo(PluginModule* module)
: Resource(module) {
+ web_request_.initialize();
}
URLRequestInfo::~URLRequestInfo() {
@@ -98,7 +115,19 @@
bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property,
const std::string& value) {
- NOTIMPLEMENTED(); // TODO(darin): Implement me!
+ // TODO(darin): Validate input. Perhaps at a different layer?
+ switch (property) {
+ case PP_URLRequestProperty_URL:
+ web_request_.setURL(GURL(value));
+ return true;
+ case PP_URLRequestProperty_Method:
+ web_request_.setHTTPMethod(WebString::fromUTF8(value));
+ return true;
+ case PP_URLRequestProperty_Headers:
+ // TODO(darin): Support extra request headers
+ NOTIMPLEMENTED();
+ return false;
+ }
return false;
}
@@ -107,4 +136,12 @@
return false;
}
+bool URLRequestInfo::AppendFileToBody(FileRef* file_ref,
+ int64_t start_offset,
+ int64_t number_of_bytes,
+ PP_Time expected_last_modified_time) {
+ NOTIMPLEMENTED(); // TODO(darin): Implement me!
+ return false;
+}
+
} // namespace pepper
« no previous file with comments | « webkit/glue/plugins/pepper_url_request_info.h ('k') | webkit/glue/resource_loader_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698