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

Unified Diff: ppapi/cpp/url_request_info.h

Issue 10800082: Merge 145885 to 1180 (M21) - PPAPI: Add an API for setting a custom user agent for URL requests. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: 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
===================================================================
--- 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
« 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