OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_CPP_URL_REQUEST_INFO_H_ | 5 #ifndef PPAPI_CPP_URL_REQUEST_INFO_H_ |
6 #define PPAPI_CPP_URL_REQUEST_INFO_H_ | 6 #define PPAPI_CPP_URL_REQUEST_INFO_H_ |
7 | 7 |
8 #include "ppapi/c/ppb_url_request_info.h" | 8 #include "ppapi/c/ppb_url_request_info.h" |
9 #include "ppapi/cpp/resource.h" | 9 #include "ppapi/cpp/resource.h" |
10 #include "ppapi/cpp/var.h" | 10 #include "ppapi/cpp/var.h" |
11 | 11 |
12 namespace pp { | 12 namespace pp { |
13 | 13 |
14 class FileRef_Dev; | 14 class FileRef_Dev; |
15 class Instance; | 15 class Instance; |
16 | 16 |
17 class URLRequestInfo : public Resource { | 17 class URLRequestInfo : public Resource { |
18 public: | 18 public: |
19 // Creates an is_null resource. | 19 // Creates an is_null resource. |
20 URLRequestInfo() {} | 20 URLRequestInfo() {} |
21 | 21 |
22 explicit URLRequestInfo(Instance* instance); | 22 explicit URLRequestInfo(Instance* instance); |
23 URLRequestInfo(const URLRequestInfo& other); | 23 URLRequestInfo(const URLRequestInfo& other); |
24 | 24 |
25 // PPB_URLRequestInfo methods: | 25 // PPB_URLRequestInfo methods: |
26 bool SetProperty(PP_URLRequestProperty property, const Var& value); | 26 bool SetProperty(PP_URLRequestProperty property, const Var& value); |
27 bool AppendDataToBody(const char* data, uint32_t len); | 27 bool AppendDataToBody(const void* data, uint32_t len); |
28 bool AppendFileToBody(const FileRef_Dev& file_ref, | 28 bool AppendFileToBody(const FileRef_Dev& file_ref, |
29 PP_Time expected_last_modified_time = 0); | 29 PP_Time expected_last_modified_time = 0); |
30 bool AppendFileRangeToBody(const FileRef_Dev& file_ref, | 30 bool AppendFileRangeToBody(const FileRef_Dev& file_ref, |
31 int64_t start_offset, | 31 int64_t start_offset, |
32 int64_t length, | 32 int64_t length, |
33 PP_Time expected_last_modified_time = 0); | 33 PP_Time expected_last_modified_time = 0); |
34 | 34 |
35 // Convenient helpers for setting properties: | 35 // Convenient helpers for setting properties: |
36 bool SetURL(const Var& url_string) { | 36 bool SetURL(const Var& url_string) { |
37 return SetProperty(PP_URLREQUESTPROPERTY_URL, url_string); | 37 return SetProperty(PP_URLREQUESTPROPERTY_URL, url_string); |
(...skipping 15 matching lines...) Expand all Loading... |
53 } | 53 } |
54 // To use the default referrer, set url_string to an Undefined Var. | 54 // To use the default referrer, set url_string to an Undefined Var. |
55 bool SetCustomReferrerURL(const Var& url_string) { | 55 bool SetCustomReferrerURL(const Var& url_string) { |
56 return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL, url_string); | 56 return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL, url_string); |
57 } | 57 } |
58 }; | 58 }; |
59 | 59 |
60 } // namespace pp | 60 } // namespace pp |
61 | 61 |
62 #endif // PPAPI_CPP_URL_REQUEST_INFO_H_ | 62 #endif // PPAPI_CPP_URL_REQUEST_INFO_H_ |
OLD | NEW |