summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/pepper_url_request_info.cc
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 20:52:49 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-22 20:52:49 +0000
commitbb55162dcf0c1100e27b1088125e3ad5175a6621 (patch)
treeb3b5049237b3f5889c6a681cc4104beff8003de6 /webkit/glue/plugins/pepper_url_request_info.cc
parentad5de0edcc8f43260e23c8dc0e300133072b5c68 (diff)
downloadchromium_src-bb55162dcf0c1100e27b1088125e3ad5175a6621.zip
chromium_src-bb55162dcf0c1100e27b1088125e3ad5175a6621.tar.gz
chromium_src-bb55162dcf0c1100e27b1088125e3ad5175a6621.tar.bz2
Pepper stream-to-file plumbing.
This just hooks up the renderer side of the IPC. R=brettw BUG=49789 TEST=none Review URL: http://codereview.chromium.org/3053009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/pepper_url_request_info.cc')
-rw-r--r--webkit/glue/plugins/pepper_url_request_info.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/webkit/glue/plugins/pepper_url_request_info.cc b/webkit/glue/plugins/pepper_url_request_info.cc
index d230f20..1229b51 100644
--- a/webkit/glue/plugins/pepper_url_request_info.cc
+++ b/webkit/glue/plugins/pepper_url_request_info.cc
@@ -122,7 +122,8 @@ const PPB_URLRequestInfo ppb_urlrequestinfo = {
} // namespace
URLRequestInfo::URLRequestInfo(PluginModule* module)
- : Resource(module) {
+ : Resource(module),
+ stream_to_file_(false) {
}
URLRequestInfo::~URLRequestInfo() {
@@ -135,8 +136,14 @@ const PPB_URLRequestInfo* URLRequestInfo::GetInterface() {
bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property,
bool value) {
- NOTIMPLEMENTED(); // TODO(darin): Implement me!
- return false;
+ switch (property) {
+ case PP_URLREQUESTPROPERTY_STREAMTOFILE:
+ stream_to_file_ = value;
+ return true;
+ default:
+ NOTIMPLEMENTED(); // TODO(darin): Implement me!
+ return false;
+ }
}
bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property,
@@ -167,6 +174,14 @@ bool URLRequestInfo::AppendFileToBody(FileRef* file_ref,
int64_t start_offset,
int64_t number_of_bytes,
PP_Time expected_last_modified_time) {
+ // Ignore a call to append nothing.
+ if (number_of_bytes == 0)
+ return true;
+
+ // Check for bad values. (-1 means read until end of file.)
+ if (start_offset < 0 || number_of_bytes < -1)
+ return false;
+
body_.push_back(BodyItem(file_ref,
start_offset,
number_of_bytes,
@@ -178,6 +193,7 @@ WebURLRequest URLRequestInfo::ToWebURLRequest(WebFrame* frame) const {
WebURLRequest web_request;
web_request.initialize();
web_request.setURL(frame->document().completeURL(WebString::fromUTF8(url_)));
+ web_request.setDownloadToFile(stream_to_file_);
if (!method_.empty())
web_request.setHTTPMethod(WebString::fromUTF8(method_));