Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: ppapi/cpp/url_request_info.h

Issue 10762017: PPAPI: Add an API for setting a custom user agent for URL requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: foo Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/c/ppb_url_request_info.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/url_request_info.h
diff --git a/ppapi/cpp/url_request_info.h b/ppapi/cpp/url_request_info.h
index 49e47ae930155ef4dcaf6189429d997e5d3ecd1c..e9ff9ea1c4d7b4febd710b89489d07173abf6a98 100644
--- a/ppapi/cpp/url_request_info.h
+++ b/ppapi/cpp/url_request_info.h
@@ -245,7 +245,6 @@ class URLRequestInfo : public Resource {
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 @@ class URLRequestInfo : public Resource {
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
« no previous file with comments | « ppapi/c/ppb_url_request_info.h ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698