OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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 PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ | |
6 #define PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ | |
7 | |
8 #include "ppapi/c/dev/ppb_url_request_info_dev.h" | |
9 #include "ppapi/cpp/resource.h" | |
10 #include "ppapi/cpp/var.h" | |
11 | |
12 namespace pp { | |
13 | |
14 class FileRef_Dev; | |
15 | |
16 class URLRequestInfo_Dev : public Resource { | |
17 public: | |
18 URLRequestInfo_Dev(); | |
19 URLRequestInfo_Dev(const URLRequestInfo_Dev& other); | |
20 | |
21 URLRequestInfo_Dev& operator=(const URLRequestInfo_Dev& other); | |
22 void swap(URLRequestInfo_Dev& other); | |
23 | |
24 // PPB_URLRequestInfo_Dev methods: | |
25 bool SetProperty(PP_URLRequestProperty_Dev property, const Var& value); | |
26 bool AppendDataToBody(const char* data, uint32_t len); | |
27 bool AppendFileToBody(const FileRef_Dev& file_ref, | |
28 PP_Time expected_last_modified_time = 0); | |
29 bool AppendFileRangeToBody(const FileRef_Dev& file_ref, | |
30 int64_t start_offset, | |
31 int64_t length, | |
32 PP_Time expected_last_modified_time = 0); | |
33 | |
34 // Convenient helpers for setting properties: | |
35 bool SetURL(const Var& url_string) { | |
36 return SetProperty(PP_URLREQUESTPROPERTY_URL, url_string); | |
37 } | |
38 bool SetMethod(const Var& method_string) { | |
39 return SetProperty(PP_URLREQUESTPROPERTY_METHOD, method_string); | |
40 } | |
41 bool SetHeaders(const Var& headers_string) { | |
42 return SetProperty(PP_URLREQUESTPROPERTY_HEADERS, headers_string); | |
43 } | |
44 bool SetStreamToFile(bool enable) { | |
45 return SetProperty(PP_URLREQUESTPROPERTY_STREAMTOFILE, enable); | |
46 } | |
47 bool SetFollowRedirects(bool enable) { | |
48 return SetProperty(PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS, enable); | |
49 } | |
50 bool SetRecordUploadProgress(bool enable) { | |
51 return SetProperty(PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS, enable); | |
52 } | |
53 }; | |
54 | |
55 } // namespace pp | |
56 | |
57 #endif // PPAPI_CPP_DEV_URL_REQUEST_INFO_DEV_H_ | |
OLD | NEW |