summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 16:51:25 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 16:51:25 +0000
commit84d5b453e3b8f4eef8cab9860a27c25466c7fe0a (patch)
tree5cb1af47b6e7fd98e81bcd2500c65a7070ed2d51 /ppapi
parentc87f49e41dbf531ec55887d611e0175d4ddcd8e8 (diff)
downloadchromium_src-84d5b453e3b8f4eef8cab9860a27c25466c7fe0a.zip
chromium_src-84d5b453e3b8f4eef8cab9860a27c25466c7fe0a.tar.gz
chromium_src-84d5b453e3b8f4eef8cab9860a27c25466c7fe0a.tar.bz2
Add CORS options to URL requests. This information will be used by the URLLoader to create the AssociatedURLLoader that sends the request.
The CORS options are simplified to fit with what is already in PPAPI. For example, since we already have a trusted interface with universal access, setting the PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS property TRUE corresponds to using access control to check the request. If we want to remove the trusted interface, then we should modify this CL so that we can specify Allow, Deny, or UseAccessControl. Also, I chose not to expose the SniffContent option from WebKit's loader. BUG=47354 TEST=test_shell_tests Review URL: http://codereview.chromium.org/6755015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/ppb_url_request_info.h21
-rw-r--r--ppapi/cpp/url_request_info.h8
2 files changed, 25 insertions, 4 deletions
diff --git a/ppapi/c/ppb_url_request_info.h b/ppapi/c/ppb_url_request_info.h
index aad1c9e..259760e 100644
--- a/ppapi/c/ppb_url_request_info.h
+++ b/ppapi/c/ppb_url_request_info.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010 The Chromium Authors. All rights reserved.
+/* Copyright (c) 2011 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.
*/
@@ -37,7 +37,7 @@ typedef enum {
// Boolean (default = PP_FALSE).
PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS,
- // Set to true if you want to be able to pull the upload progress via the
+ // Set to true if you want to be able to poll the upload progress via the
// URLLoader.GetUploadProgress function.
//
// Boolean (default = PP_FALSE).
@@ -51,7 +51,22 @@ typedef enum {
// result.
//
// Undefined/String (default = Undefined)
- PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL
+ PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL,
+
+ // Whether cross-origin requests are allowed. Cross-origin requests are made
+ // using the CORS (Cross-Origin Resource Sharing) algorithm to check whether
+ // the request should be allowed. For the complete CORS algorithm, see:
+ // http://www.w3.org/TR/access-control
+ //
+ // Boolean (default = PP_FALSE).
+ PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,
+
+ // Whether HTTP credentials are sent with cross-origin requests. If false,
+ // no credentials are sent with the request and cookies are ignored in the
+ // response. If the request is not cross-origin, this property is ignored.
+ //
+ // Boolean (default = PP_FALSE).
+ PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS
} PP_URLRequestProperty;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4);
/**
diff --git a/ppapi/cpp/url_request_info.h b/ppapi/cpp/url_request_info.h
index 2530085..9d38c69 100644
--- a/ppapi/cpp/url_request_info.h
+++ b/ppapi/cpp/url_request_info.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -58,6 +58,12 @@ class URLRequestInfo : public Resource {
bool SetCustomReferrerURL(const Var& url_string) {
return SetProperty(PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL, url_string);
}
+ bool SetAllowCrossOriginRequests(bool enable) {
+ return SetProperty(PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS, enable);
+ }
+ bool SetAllowCredentials(bool enable) {
+ return SetProperty(PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, enable);
+ }
};
} // namespace pp