Index: ppapi/cpp/url_request_info.h |
=================================================================== |
--- ppapi/cpp/url_request_info.h (revision 147912) |
+++ ppapi/cpp/url_request_info.h (working copy) |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
@@ -245,7 +245,6 @@ |
return SetProperty(PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, enable); |
} |
- |
/// SetCustomContentTransferEncoding() sets the |
/// <code>PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING</code> |
/// (corresponding to a string of type <code>PP_VARTYPE_STRING</code> or |
@@ -309,6 +308,25 @@ |
return SetProperty(PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD, |
size); |
} |
+ |
+ /// SetCustomUserAgent() sets the |
+ /// <code>PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT</code> (corresponding to a |
+ /// string of type <code>PP_VARTYPE_STRING</code> or might be set to undefined |
+ /// as <code>PP_VARTYPE_UNDEFINED</code>). Set it to a string to set a custom |
+ /// user-agent header (if empty, that header will be omitted), or to undefined |
+ /// to use the default. Only loaders with universal access (only available on |
+ /// trusted implementations) will accept <code>URLRequestInfo</code> objects |
+ /// that try to set a custom user agent; if given to a loader without |
+ /// universal access, <code>PP_ERROR_BADARGUMENT</code> will result. |
+ /// |
+ /// @param[in] user_agent A <code>Var</code> containing the property value. To |
+ /// use the default user agent, set <code>user_agent</code> to an undefined |
+ /// <code>Var</code>. |
+ /// |
+ /// @return true if successful, false if the parameter is invalid. |
+ bool SetCustomUserAgent(const Var& user_agent) { |
+ return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT, user_agent); |
+ } |
}; |
} // namespace pp |