| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_IMPL_H_ | |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_IMPL_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "ppapi/thunk/ppb_url_request_info_api.h" | |
| 10 #include "ppapi/shared_impl/ppb_url_request_info_shared.h" | |
| 11 #include "webkit/plugins/webkit_plugins_export.h" | |
| 12 | |
| 13 namespace WebKit { | |
| 14 class WebFrame; | |
| 15 class WebHTTPBody; | |
| 16 class WebURLRequest; | |
| 17 } | |
| 18 | |
| 19 namespace webkit { | |
| 20 namespace ppapi { | |
| 21 | |
| 22 class WEBKIT_PLUGINS_EXPORT PPB_URLRequestInfo_Impl : | |
| 23 public ::ppapi::PPB_URLRequestInfo_Shared { | |
| 24 public: | |
| 25 explicit PPB_URLRequestInfo_Impl( | |
| 26 PP_Instance instance, | |
| 27 const ::ppapi::PPB_URLRequestInfo_Data& data); | |
| 28 virtual ~PPB_URLRequestInfo_Impl(); | |
| 29 | |
| 30 // Creates the WebKit URL request from the current request info. Returns | |
| 31 // true on success, false if the request is invalid (in which case *dest may | |
| 32 // be partially initialized). | |
| 33 bool ToWebURLRequest(WebKit::WebFrame* frame, | |
| 34 WebKit::WebURLRequest* dest); | |
| 35 | |
| 36 // Whether universal access is required to use this request. | |
| 37 bool RequiresUniversalAccess() const; | |
| 38 | |
| 39 private: | |
| 40 friend class URLRequestInfoTest; | |
| 41 | |
| 42 // Checks that the request data is valid. Returns false on failure. Note that | |
| 43 // method and header validation is done by the URL loader when the request is | |
| 44 // opened, and any access errors are returned asynchronously. | |
| 45 bool ValidateData(); | |
| 46 | |
| 47 // Appends the file ref given the Resource pointer associated with it to the | |
| 48 // given HTTP body, returning true on success. | |
| 49 bool AppendFileRefToBody(::ppapi::Resource* file_ref_resource, | |
| 50 int64_t start_offset, | |
| 51 int64_t number_of_bytes, | |
| 52 PP_Time expected_last_modified_time, | |
| 53 WebKit::WebHTTPBody *http_body); | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Impl); | |
| 56 }; | |
| 57 | |
| 58 } // namespace ppapi | |
| 59 } // namespace webkit | |
| 60 | |
| 61 #endif // WEBKIT_PLUGINS_PPAPI_PPB_URL_REQUEST_INFO_IMPL_H_ | |
| OLD | NEW |