| Index: webkit/plugins/ppapi/ppb_url_request_info_impl.cc
|
| ===================================================================
|
| --- webkit/plugins/ppapi/ppb_url_request_info_impl.cc (revision 0)
|
| +++ webkit/plugins/ppapi/ppb_url_request_info_impl.cc (working copy)
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/glue/plugins/pepper_url_request_info.h"
|
| +#include "webkit/plugins/ppapi/ppb_url_request_info_impl.h"
|
|
|
| #include "base/logging.h"
|
| #include "base/string_util.h"
|
| @@ -15,11 +15,11 @@
|
| #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
|
| #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
|
| -#include "webkit/glue/plugins/pepper_common.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"
|
| +#include "webkit/plugins/ppapi/common.h"
|
| +#include "webkit/plugins/ppapi/plugin_module.h"
|
| +#include "webkit/plugins/ppapi/ppb_file_ref_impl.h"
|
| +#include "webkit/plugins/ppapi/string.h"
|
| +#include "webkit/plugins/ppapi/var.h"
|
| #include "webkit/glue/webkit_glue.h"
|
|
|
| using WebKit::WebData;
|
| @@ -29,7 +29,8 @@
|
| using WebKit::WebURL;
|
| using WebKit::WebURLRequest;
|
|
|
| -namespace pepper {
|
| +namespace webkit {
|
| +namespace ppapi {
|
|
|
| namespace {
|
|
|
| @@ -52,20 +53,20 @@
|
| if (!module)
|
| return 0;
|
|
|
| - URLRequestInfo* request = new URLRequestInfo(module);
|
| + PPB_URLRequestInfo_Impl* request = new PPB_URLRequestInfo_Impl(module);
|
|
|
| return request->GetReference();
|
| }
|
|
|
| PP_Bool IsURLRequestInfo(PP_Resource resource) {
|
| - return BoolToPPBool(!!Resource::GetAs<URLRequestInfo>(resource));
|
| + return BoolToPPBool(!!Resource::GetAs<PPB_URLRequestInfo_Impl>(resource));
|
| }
|
|
|
| PP_Bool SetProperty(PP_Resource request_id,
|
| PP_URLRequestProperty property,
|
| PP_Var var) {
|
| - scoped_refptr<URLRequestInfo> request(
|
| - Resource::GetAs<URLRequestInfo>(request_id));
|
| + scoped_refptr<PPB_URLRequestInfo_Impl> request(
|
| + Resource::GetAs<PPB_URLRequestInfo_Impl>(request_id));
|
| if (!request)
|
| return PP_FALSE;
|
|
|
| @@ -89,8 +90,8 @@
|
| PP_Bool AppendDataToBody(PP_Resource request_id,
|
| const char* data,
|
| uint32_t len) {
|
| - scoped_refptr<URLRequestInfo> request(
|
| - Resource::GetAs<URLRequestInfo>(request_id));
|
| + scoped_refptr<PPB_URLRequestInfo_Impl> request(
|
| + Resource::GetAs<PPB_URLRequestInfo_Impl>(request_id));
|
| if (!request)
|
| return PP_FALSE;
|
|
|
| @@ -102,12 +103,13 @@
|
| int64_t start_offset,
|
| int64_t number_of_bytes,
|
| PP_Time expected_last_modified_time) {
|
| - scoped_refptr<URLRequestInfo> request(
|
| - Resource::GetAs<URLRequestInfo>(request_id));
|
| + scoped_refptr<PPB_URLRequestInfo_Impl> request(
|
| + Resource::GetAs<PPB_URLRequestInfo_Impl>(request_id));
|
| if (!request)
|
| return PP_FALSE;
|
|
|
| - scoped_refptr<FileRef> file_ref(Resource::GetAs<FileRef>(file_ref_id));
|
| + scoped_refptr<PPB_FileRef_Impl> file_ref(
|
| + Resource::GetAs<PPB_FileRef_Impl>(file_ref_id));
|
| if (!file_ref)
|
| return PP_FALSE;
|
|
|
| @@ -127,7 +129,7 @@
|
|
|
| } // namespace
|
|
|
| -struct URLRequestInfo::BodyItem {
|
| +struct PPB_URLRequestInfo_Impl::BodyItem {
|
| BodyItem(const std::string& data)
|
| : data(data),
|
| start_offset(0),
|
| @@ -135,7 +137,7 @@
|
| expected_last_modified_time(0.0) {
|
| }
|
|
|
| - BodyItem(FileRef* file_ref,
|
| + BodyItem(PPB_FileRef_Impl* file_ref,
|
| int64_t start_offset,
|
| int64_t number_of_bytes,
|
| PP_Time expected_last_modified_time)
|
| @@ -146,13 +148,13 @@
|
| }
|
|
|
| std::string data;
|
| - scoped_refptr<FileRef> file_ref;
|
| + scoped_refptr<PPB_FileRef_Impl> file_ref;
|
| int64_t start_offset;
|
| int64_t number_of_bytes;
|
| PP_Time expected_last_modified_time;
|
| };
|
|
|
| -URLRequestInfo::URLRequestInfo(PluginModule* module)
|
| +PPB_URLRequestInfo_Impl::PPB_URLRequestInfo_Impl(PluginModule* module)
|
| : Resource(module),
|
| stream_to_file_(false),
|
| follow_redirects_(true),
|
| @@ -160,20 +162,20 @@
|
| record_upload_progress_(false) {
|
| }
|
|
|
| -URLRequestInfo::~URLRequestInfo() {
|
| +PPB_URLRequestInfo_Impl::~PPB_URLRequestInfo_Impl() {
|
| }
|
|
|
| // static
|
| -const PPB_URLRequestInfo* URLRequestInfo::GetInterface() {
|
| +const PPB_URLRequestInfo* PPB_URLRequestInfo_Impl::GetInterface() {
|
| return &ppb_urlrequestinfo;
|
| }
|
|
|
| -URLRequestInfo* URLRequestInfo::AsURLRequestInfo() {
|
| +PPB_URLRequestInfo_Impl* PPB_URLRequestInfo_Impl::AsPPB_URLRequestInfo_Impl() {
|
| return this;
|
| }
|
|
|
| -bool URLRequestInfo::SetBooleanProperty(PP_URLRequestProperty property,
|
| - bool value) {
|
| +bool PPB_URLRequestInfo_Impl::SetBooleanProperty(PP_URLRequestProperty property,
|
| + bool value) {
|
| switch (property) {
|
| case PP_URLREQUESTPROPERTY_STREAMTOFILE:
|
| stream_to_file_ = value;
|
| @@ -193,8 +195,8 @@
|
| }
|
| }
|
|
|
| -bool URLRequestInfo::SetStringProperty(PP_URLRequestProperty property,
|
| - const std::string& value) {
|
| +bool PPB_URLRequestInfo_Impl::SetStringProperty(PP_URLRequestProperty property,
|
| + const std::string& value) {
|
| // TODO(darin): Validate input. Perhaps at a different layer?
|
| switch (property) {
|
| case PP_URLREQUESTPROPERTY_URL:
|
| @@ -211,16 +213,17 @@
|
| }
|
| }
|
|
|
| -bool URLRequestInfo::AppendDataToBody(const std::string& data) {
|
| +bool PPB_URLRequestInfo_Impl::AppendDataToBody(const std::string& data) {
|
| if (!data.empty())
|
| body_.push_back(BodyItem(data));
|
| return true;
|
| }
|
|
|
| -bool URLRequestInfo::AppendFileToBody(FileRef* file_ref,
|
| - int64_t start_offset,
|
| - int64_t number_of_bytes,
|
| - PP_Time expected_last_modified_time) {
|
| +bool PPB_URLRequestInfo_Impl::AppendFileToBody(
|
| + PPB_FileRef_Impl* 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;
|
| @@ -236,7 +239,7 @@
|
| return true;
|
| }
|
|
|
| -WebURLRequest URLRequestInfo::ToWebURLRequest(WebFrame* frame) const {
|
| +WebURLRequest PPB_URLRequestInfo_Impl::ToWebURLRequest(WebFrame* frame) const {
|
| WebURLRequest web_request;
|
| web_request.initialize();
|
| web_request.setURL(frame->document().completeURL(WebString::fromUTF8(url_)));
|
| @@ -279,4 +282,6 @@
|
| return web_request;
|
| }
|
|
|
| -} // namespace pepper
|
| +} // namespace ppapi
|
| +} // namespace webkit
|
| +
|
|
|