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

Unified Diff: webkit/plugins/ppapi/ppb_url_request_info_impl.cc

Issue 6652014: Pepper: Add a property to URLRequestInfo to skip header validation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: used undefined var to unset Created 9 years, 9 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
Index: webkit/plugins/ppapi/ppb_url_request_info_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
index f7b472eea244251b655ee2c4654686110f10b709..339a2d0958063cdeada8f02c153ec7d305044dd2 100644
--- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc
@@ -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.
@@ -103,6 +103,9 @@ PP_Bool SetProperty(PP_Resource request_id,
if (!request)
return PP_FALSE;
+ if (var.type == PP_VARTYPE_UNDEFINED)
brettw 2011/03/11 23:31:05 Now that we have 3 of these, I think it would be m
viettrungluu 2011/03/14 17:13:53 Done.
+ return BoolToPPBool(request->SetUndefinedProperty(property));
+
if (var.type == PP_VARTYPE_BOOL) {
return BoolToPPBool(
request->SetBooleanProperty(property,
@@ -192,7 +195,8 @@ PPB_URLRequestInfo_Impl::PPB_URLRequestInfo_Impl(PluginInstance* instance)
stream_to_file_(false),
follow_redirects_(true),
record_download_progress_(false),
- record_upload_progress_(false) {
+ record_upload_progress_(false),
+ has_custom_referrer_url_(false) {
}
PPB_URLRequestInfo_Impl::~PPB_URLRequestInfo_Impl() {
@@ -207,6 +211,18 @@ PPB_URLRequestInfo_Impl* PPB_URLRequestInfo_Impl::AsPPB_URLRequestInfo_Impl() {
return this;
}
+bool PPB_URLRequestInfo_Impl::SetUndefinedProperty(
+ PP_URLRequestProperty property) {
+ switch (property) {
+ case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL:
+ has_custom_referrer_url_ = false;
+ custom_referrer_url_ = std::string();
+ return true;
+ default:
+ return false;
+ }
+}
+
bool PPB_URLRequestInfo_Impl::SetBooleanProperty(PP_URLRequestProperty property,
bool value) {
switch (property) {
@@ -242,6 +258,10 @@ bool PPB_URLRequestInfo_Impl::SetStringProperty(PP_URLRequestProperty property,
return false;
headers_ = value;
return true;
+ case PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL:
+ has_custom_referrer_url_ = true;
+ custom_referrer_url_ = value;
+ return true;
default:
return false;
}
@@ -311,10 +331,19 @@ WebURLRequest PPB_URLRequestInfo_Impl::ToWebURLRequest(WebFrame* frame) const {
web_request.setHTTPBody(http_body);
}
- frame->setReferrerForRequest(web_request, WebURL()); // Use default.
+ if (has_custom_referrer_url_) {
+ if (!custom_referrer_url_.empty())
+ frame->setReferrerForRequest(web_request, GURL(custom_referrer_url_));
+ } else {
+ frame->setReferrerForRequest(web_request, WebURL()); // Use default.
+ }
+
return web_request;
}
+bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const {
+ return has_custom_referrer_url_;
+}
+
} // namespace ppapi
} // namespace webkit
-

Powered by Google App Engine
This is Rietveld 408576698