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

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

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests fixed Created 9 years, 4 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/ppb_url_request_info_impl.h
diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.h b/webkit/plugins/ppapi/ppb_url_request_info_impl.h
index 277edfb247d0dac46cc7b5675477a3dc10eb70ea..a534002ab9f8644796bf02632195415fb3cd75fb 100644
--- a/webkit/plugins/ppapi/ppb_url_request_info_impl.h
+++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.h
@@ -5,105 +5,49 @@
#ifndef WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_IMPL_H_
#define WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_IMPL_H_
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
-#include "ppapi/c/ppb_url_request_info.h"
#include "ppapi/thunk/ppb_url_request_info_api.h"
-#include "ppapi/shared_impl/resource.h"
+#include "ppapi/shared_impl/url_request_info_impl.h"
namespace WebKit {
class WebFrame;
+class WebHTTPBody;
class WebURLRequest;
}
namespace webkit {
namespace ppapi {
-class PPB_FileRef_Impl;
-
-class PPB_URLRequestInfo_Impl : public ::ppapi::Resource,
- public ::ppapi::thunk::PPB_URLRequestInfo_API {
+class PPB_URLRequestInfo_Impl : public ::ppapi::URLRequestInfoImpl {
public:
- explicit PPB_URLRequestInfo_Impl(PP_Instance instance);
+ explicit PPB_URLRequestInfo_Impl(
+ PP_Instance instance,
+ const ::ppapi::PPB_URLRequestInfo_Data& data);
virtual ~PPB_URLRequestInfo_Impl();
- // Resource overrides.
- virtual PPB_URLRequestInfo_API* AsPPB_URLRequestInfo_API() OVERRIDE;
-
- // PPB_URLRequestInfo implementation.
- virtual PP_Bool SetProperty(PP_URLRequestProperty property,
- PP_Var var) OVERRIDE;
- virtual PP_Bool AppendDataToBody(const void* data, uint32_t len) OVERRIDE;
- virtual PP_Bool AppendFileToBody(
- PP_Resource file_ref,
- int64_t start_offset,
- int64_t number_of_bytes,
- PP_Time expected_last_modified_time) OVERRIDE;
-
- WebKit::WebURLRequest ToWebURLRequest(WebKit::WebFrame* frame) const;
+ // Creates the WebKit URL request from the current request info. Returns
+ // true on success, false if the request is invalid (in which case *dest may
+ // be partially initialized).
+ bool ToWebURLRequest(WebKit::WebFrame* frame,
+ WebKit::WebURLRequest* dest);
// Whether universal access is required to use this request.
bool RequiresUniversalAccess() const;
- bool SetUndefinedProperty(PP_URLRequestProperty property);
- bool SetBooleanProperty(PP_URLRequestProperty property, bool value);
- bool SetIntegerProperty(PP_URLRequestProperty property, int32_t value);
- bool SetStringProperty(PP_URLRequestProperty property,
- const std::string& value);
-
-
- bool follow_redirects() { return follow_redirects_; }
-
- bool record_download_progress() const { return record_download_progress_; }
- bool record_upload_progress() const { return record_upload_progress_; }
-
- bool allow_cross_origin_requests() const {
- return allow_cross_origin_requests_;
- }
- bool allow_credentials() const { return allow_credentials_; }
-
- int32_t prefetch_buffer_upper_threshold() const {
- return prefetch_buffer_upper_threshold_;
- }
- int32_t prefetch_buffer_lower_threshold() const {
- return prefetch_buffer_lower_threshold_;
- }
-
private:
- struct BodyItem;
- typedef std::vector<BodyItem> Body;
-
- std::string url_;
- std::string method_;
- std::string headers_;
- Body body_;
-
- bool stream_to_file_;
- bool follow_redirects_;
- bool record_download_progress_;
- bool record_upload_progress_;
-
- // |has_custom_referrer_url_| is set to false if a custom referrer hasn't been
- // set (or has been set to an Undefined Var) and the default referrer should
- // be used. (Setting the custom referrer to an empty string indicates that no
- // referrer header should be generated.)
- bool has_custom_referrer_url_;
- std::string custom_referrer_url_;
-
- bool allow_cross_origin_requests_;
- bool allow_credentials_;
-
- // Similar to the custom referrer (above), but for custom content transfer
- // encoding.
- bool has_custom_content_transfer_encoding_;
- std::string custom_content_transfer_encoding_;
-
- // Specify permitted range for the size of the buffer unconsumed by plugin.
- int32_t prefetch_buffer_upper_threshold_;
- int32_t prefetch_buffer_lower_threshold_;
+ friend class URLRequestInfoTest;
+
+ // Checks that the request data is valid and does some canonicalization of
+ // it. Returns false on failure
+ bool ValidateData();
+
+ // Appends the file ref given the Resource pointer associated with it to the
+ // given HTTP body, returning true on success.
+ bool AppendFileRefToBody(::ppapi::Resource* file_ref_resource,
+ int64_t start_offset,
+ int64_t number_of_bytes,
+ PP_Time expected_last_modified_time,
+ WebKit::WebHTTPBody *http_body);
DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Impl);
};

Powered by Google App Engine
This is Rietveld 408576698