| 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 #include "ppapi/shared_impl/ppb_url_request_info_shared.h" | 5 #include "ppapi/shared_impl/ppb_url_request_info_shared.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "ppapi/shared_impl/var.h" | 8 #include "ppapi/shared_impl/var.h" |
| 9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/ppb_file_ref_api.h" | 10 #include "ppapi/thunk/ppb_file_ref_api.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 stream_to_file(false), | 55 stream_to_file(false), |
| 56 follow_redirects(true), | 56 follow_redirects(true), |
| 57 record_download_progress(false), | 57 record_download_progress(false), |
| 58 record_upload_progress(false), | 58 record_upload_progress(false), |
| 59 has_custom_referrer_url(false), | 59 has_custom_referrer_url(false), |
| 60 custom_referrer_url(), | 60 custom_referrer_url(), |
| 61 allow_cross_origin_requests(false), | 61 allow_cross_origin_requests(false), |
| 62 allow_credentials(false), | 62 allow_credentials(false), |
| 63 has_custom_content_transfer_encoding(false), | 63 has_custom_content_transfer_encoding(false), |
| 64 custom_content_transfer_encoding(), | 64 custom_content_transfer_encoding(), |
| 65 has_custom_user_agent(false), |
| 66 custom_user_agent(), |
| 65 prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold), | 67 prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold), |
| 66 prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold), | 68 prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold), |
| 67 body() { | 69 body() { |
| 68 } | 70 } |
| 69 | 71 |
| 70 PPB_URLRequestInfo_Data::~PPB_URLRequestInfo_Data() { | 72 PPB_URLRequestInfo_Data::~PPB_URLRequestInfo_Data() { |
| 71 } | 73 } |
| 72 | 74 |
| 73 PPB_URLRequestInfo_Shared::PPB_URLRequestInfo_Shared( | 75 PPB_URLRequestInfo_Shared::PPB_URLRequestInfo_Shared( |
| 74 ResourceObjectType type, | 76 ResourceObjectType type, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // SetProperty() above for why. | 176 // SetProperty() above for why. |
| 175 switch (property) { | 177 switch (property) { |
| 176 case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: | 178 case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: |
| 177 data_.has_custom_referrer_url = false; | 179 data_.has_custom_referrer_url = false; |
| 178 data_.custom_referrer_url = std::string(); | 180 data_.custom_referrer_url = std::string(); |
| 179 return true; | 181 return true; |
| 180 case PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: | 182 case PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: |
| 181 data_.has_custom_content_transfer_encoding = false; | 183 data_.has_custom_content_transfer_encoding = false; |
| 182 data_.custom_content_transfer_encoding = std::string(); | 184 data_.custom_content_transfer_encoding = std::string(); |
| 183 return true; | 185 return true; |
| 186 case PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT: |
| 187 data_.has_custom_user_agent = false; |
| 188 data_.custom_user_agent = std::string(); |
| 189 return true; |
| 184 default: | 190 default: |
| 185 return false; | 191 return false; |
| 186 } | 192 } |
| 187 } | 193 } |
| 188 | 194 |
| 189 bool PPB_URLRequestInfo_Shared::SetBooleanProperty( | 195 bool PPB_URLRequestInfo_Shared::SetBooleanProperty( |
| 190 PP_URLRequestProperty property, | 196 PP_URLRequestProperty property, |
| 191 bool value) { | 197 bool value) { |
| 192 // IMPORTANT: Do not do security validation of parameters at this level | 198 // IMPORTANT: Do not do security validation of parameters at this level |
| 193 // without also adding them to PPB_URLRequestInfo_Impl::ValidateData. See | 199 // without also adding them to PPB_URLRequestInfo_Impl::ValidateData. See |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 data_.headers = value; | 257 data_.headers = value; |
| 252 return true; | 258 return true; |
| 253 case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: | 259 case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: |
| 254 data_.has_custom_referrer_url = true; | 260 data_.has_custom_referrer_url = true; |
| 255 data_.custom_referrer_url = value; | 261 data_.custom_referrer_url = value; |
| 256 return true; | 262 return true; |
| 257 case PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: | 263 case PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: |
| 258 data_.has_custom_content_transfer_encoding = true; | 264 data_.has_custom_content_transfer_encoding = true; |
| 259 data_.custom_content_transfer_encoding = value; | 265 data_.custom_content_transfer_encoding = value; |
| 260 return true; | 266 return true; |
| 267 case PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT: |
| 268 data_.has_custom_user_agent = true; |
| 269 data_.custom_user_agent = value; |
| 270 return true; |
| 261 default: | 271 default: |
| 262 return false; | 272 return false; |
| 263 } | 273 } |
| 264 } | 274 } |
| 265 | 275 |
| 266 } // namespace ppapi | 276 } // namespace ppapi |
| OLD | NEW |