| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 /// and cookies are ignored in the response. If the request is not | 238 /// and cookies are ignored in the response. If the request is not |
| 239 /// cross-origin, this property is ignored. | 239 /// cross-origin, this property is ignored. |
| 240 /// | 240 /// |
| 241 /// @param[in] enable A <code>bool</code> containing the property value. | 241 /// @param[in] enable A <code>bool</code> containing the property value. |
| 242 /// | 242 /// |
| 243 /// @return true if successful, false if the parameter is invalid. | 243 /// @return true if successful, false if the parameter is invalid. |
| 244 bool SetAllowCredentials(bool enable) { | 244 bool SetAllowCredentials(bool enable) { |
| 245 return SetProperty(PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, enable); | 245 return SetProperty(PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, enable); |
| 246 } | 246 } |
| 247 | 247 |
| 248 | |
| 249 /// SetCustomContentTransferEncoding() sets the | 248 /// SetCustomContentTransferEncoding() sets the |
| 250 /// <code>PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING</code> | 249 /// <code>PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING</code> |
| 251 /// (corresponding to a string of type <code>PP_VARTYPE_STRING</code> or | 250 /// (corresponding to a string of type <code>PP_VARTYPE_STRING</code> or |
| 252 /// might be set to undefined as <code>PP_VARTYPE_UNDEFINED</code>). Set it | 251 /// might be set to undefined as <code>PP_VARTYPE_UNDEFINED</code>). Set it |
| 253 /// to a string to set a custom content-transfer-encoding header (if empty, | 252 /// to a string to set a custom content-transfer-encoding header (if empty, |
| 254 /// that header will be omitted), or to undefined to use the default (if | 253 /// that header will be omitted), or to undefined to use the default (if |
| 255 /// any). Only loaders with universal access (only available on trusted | 254 /// any). Only loaders with universal access (only available on trusted |
| 256 /// implementations) will accept <code>URLRequestInfo</code> objects that try | 255 /// implementations) will accept <code>URLRequestInfo</code> objects that try |
| 257 /// to set a custom content transfer encoding; if given to a loader without | 256 /// to set a custom content transfer encoding; if given to a loader without |
| 258 /// universal access, <code>PP_ERROR_BADARGUMENT</code> will result. | 257 /// universal access, <code>PP_ERROR_BADARGUMENT</code> will result. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 /// <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also | 301 /// <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also |
| 303 /// be set. Behavior is undefined if the former is >= the latter. | 302 /// be set. Behavior is undefined if the former is >= the latter. |
| 304 /// | 303 /// |
| 305 /// @param[in] size An int32_t containing the property value. | 304 /// @param[in] size An int32_t containing the property value. |
| 306 /// | 305 /// |
| 307 /// @return true if successful, false if the parameter is invalid. | 306 /// @return true if successful, false if the parameter is invalid. |
| 308 bool SetPrefetchBufferLowerThreshold(int32_t size) { | 307 bool SetPrefetchBufferLowerThreshold(int32_t size) { |
| 309 return SetProperty(PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD, | 308 return SetProperty(PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD, |
| 310 size); | 309 size); |
| 311 } | 310 } |
| 311 |
| 312 /// SetCustomUserAgent() sets the |
| 313 /// <code>PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT</code> (corresponding to a |
| 314 /// string of type <code>PP_VARTYPE_STRING</code> or might be set to undefined |
| 315 /// as <code>PP_VARTYPE_UNDEFINED</code>). Set it to a string to set a custom |
| 316 /// user-agent header (if empty, that header will be omitted), or to undefined |
| 317 /// to use the default. Only loaders with universal access (only available on |
| 318 /// trusted implementations) will accept <code>URLRequestInfo</code> objects |
| 319 /// that try to set a custom user agent; if given to a loader without |
| 320 /// universal access, <code>PP_ERROR_BADARGUMENT</code> will result. |
| 321 /// |
| 322 /// @param[in] user_agent A <code>Var</code> containing the property value. To |
| 323 /// use the default user agent, set <code>user_agent</code> to an undefined |
| 324 /// <code>Var</code>. |
| 325 /// |
| 326 /// @return true if successful, false if the parameter is invalid. |
| 327 bool SetCustomUserAgent(const Var& user_agent) { |
| 328 return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT, user_agent); |
| 329 } |
| 312 }; | 330 }; |
| 313 | 331 |
| 314 } // namespace pp | 332 } // namespace pp |
| 315 | 333 |
| 316 #endif // PPAPI_CPP_URL_REQUEST_INFO_H_ | 334 #endif // PPAPI_CPP_URL_REQUEST_INFO_H_ |
| OLD | NEW |