| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SHARED_IMPL_PPB_URL_REQUEST_INFO_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPB_URL_REQUEST_INFO_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/c/pp_stdint.h" |
| 13 #include "ppapi/thunk/ppb_url_request_info_api.h" | 13 #include "ppapi/c/pp_time.h" |
| 14 #include "ppapi/shared_impl/host_resource.h" |
| 15 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 14 | 16 |
| 15 namespace ppapi { | 17 namespace ppapi { |
| 16 | 18 |
| 17 struct PPAPI_SHARED_EXPORT PPB_URLRequestInfo_Data { | 19 class Resource; |
| 20 |
| 21 struct PPAPI_SHARED_EXPORT URLRequestInfoData { |
| 18 struct PPAPI_SHARED_EXPORT BodyItem { | 22 struct PPAPI_SHARED_EXPORT BodyItem { |
| 19 BodyItem(); | 23 BodyItem(); |
| 20 explicit BodyItem(const std::string& data); | 24 explicit BodyItem(const std::string& data); |
| 21 BodyItem(Resource* file_ref, | 25 BodyItem(Resource* file_ref, |
| 22 int64_t start_offset, | 26 int64_t start_offset, |
| 23 int64_t number_of_bytes, | 27 int64_t number_of_bytes, |
| 24 PP_Time expected_last_modified_time); | 28 PP_Time expected_last_modified_time); |
| 25 | 29 |
| 26 // Set if the input is a file, false means the |data| is valid. | 30 // Set if the input is a file, false means the |data| is valid. |
| 27 bool is_file; | 31 bool is_file; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 HostResource file_ref_host_resource; | 47 HostResource file_ref_host_resource; |
| 44 | 48 |
| 45 int64_t start_offset; | 49 int64_t start_offset; |
| 46 int64_t number_of_bytes; | 50 int64_t number_of_bytes; |
| 47 PP_Time expected_last_modified_time; | 51 PP_Time expected_last_modified_time; |
| 48 | 52 |
| 49 // If you add more stuff here, be sure to modify the serialization rules in | 53 // If you add more stuff here, be sure to modify the serialization rules in |
| 50 // ppapi_messages.h | 54 // ppapi_messages.h |
| 51 }; | 55 }; |
| 52 | 56 |
| 53 PPB_URLRequestInfo_Data(); | 57 URLRequestInfoData(); |
| 54 ~PPB_URLRequestInfo_Data(); | 58 ~URLRequestInfoData(); |
| 55 | 59 |
| 56 std::string url; | 60 std::string url; |
| 57 std::string method; | 61 std::string method; |
| 58 std::string headers; | 62 std::string headers; |
| 59 | 63 |
| 60 bool stream_to_file; | 64 bool stream_to_file; |
| 61 bool follow_redirects; | 65 bool follow_redirects; |
| 62 bool record_download_progress; | 66 bool record_download_progress; |
| 63 bool record_upload_progress; | 67 bool record_upload_progress; |
| 64 | 68 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 | 85 |
| 82 int32_t prefetch_buffer_upper_threshold; | 86 int32_t prefetch_buffer_upper_threshold; |
| 83 int32_t prefetch_buffer_lower_threshold; | 87 int32_t prefetch_buffer_lower_threshold; |
| 84 | 88 |
| 85 std::vector<BodyItem> body; | 89 std::vector<BodyItem> body; |
| 86 | 90 |
| 87 // If you add more stuff here, be sure to modify the serialization rules in | 91 // If you add more stuff here, be sure to modify the serialization rules in |
| 88 // ppapi_messages.h | 92 // ppapi_messages.h |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 class PPAPI_SHARED_EXPORT PPB_URLRequestInfo_Shared | |
| 92 : public ::ppapi::Resource, | |
| 93 public ::ppapi::thunk::PPB_URLRequestInfo_API { | |
| 94 public: | |
| 95 PPB_URLRequestInfo_Shared(ResourceObjectType type, | |
| 96 PP_Instance instance, | |
| 97 const PPB_URLRequestInfo_Data& data); | |
| 98 ~PPB_URLRequestInfo_Shared(); | |
| 99 | |
| 100 // Resource overrides. | |
| 101 virtual thunk::PPB_URLRequestInfo_API* AsPPB_URLRequestInfo_API() OVERRIDE; | |
| 102 | |
| 103 // PPB_URLRequestInfo_API implementation. | |
| 104 virtual PP_Bool SetProperty(PP_URLRequestProperty property, | |
| 105 PP_Var var) OVERRIDE; | |
| 106 virtual PP_Bool AppendDataToBody(const void* data, uint32_t len) OVERRIDE; | |
| 107 virtual PP_Bool AppendFileToBody( | |
| 108 PP_Resource file_ref, | |
| 109 int64_t start_offset, | |
| 110 int64_t number_of_bytes, | |
| 111 PP_Time expected_last_modified_time) OVERRIDE; | |
| 112 virtual const PPB_URLRequestInfo_Data& GetData() const OVERRIDE; | |
| 113 | |
| 114 protected: | |
| 115 // Constructor used by the webkit implementation. | |
| 116 PPB_URLRequestInfo_Shared(PP_Instance instance, | |
| 117 const PPB_URLRequestInfo_Data& data); | |
| 118 | |
| 119 bool SetUndefinedProperty(PP_URLRequestProperty property); | |
| 120 bool SetBooleanProperty(PP_URLRequestProperty property, bool value); | |
| 121 bool SetIntegerProperty(PP_URLRequestProperty property, int32_t value); | |
| 122 bool SetStringProperty(PP_URLRequestProperty property, | |
| 123 const std::string& value); | |
| 124 | |
| 125 const PPB_URLRequestInfo_Data& data() const { return data_; } | |
| 126 PPB_URLRequestInfo_Data& data() { return data_; } | |
| 127 | |
| 128 private: | |
| 129 PPB_URLRequestInfo_Data data_; | |
| 130 | |
| 131 DISALLOW_IMPLICIT_CONSTRUCTORS(PPB_URLRequestInfo_Shared); | |
| 132 }; | |
| 133 | |
| 134 } // namespace ppapi | 95 } // namespace ppapi |
| 135 | 96 |
| 136 #endif // PPAPI_SHARED_IMPL_PPB_URL_REQUEST_INFO_SHARED_H_ | 97 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_ |
| OLD | NEW |