| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_url_request_info_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "googleurl/src/url_util.h" | 10 #include "googleurl/src/url_util.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 DCHECK(!body_[i].data.empty()); | 375 DCHECK(!body_[i].data.empty()); |
| 376 http_body.appendData(WebData(body_[i].data)); | 376 http_body.appendData(WebData(body_[i].data)); |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 web_request.setHTTPBody(http_body); | 379 web_request.setHTTPBody(http_body); |
| 380 } | 380 } |
| 381 | 381 |
| 382 if (has_custom_referrer_url_) { | 382 if (has_custom_referrer_url_) { |
| 383 if (!custom_referrer_url_.empty()) | 383 if (!custom_referrer_url_.empty()) |
| 384 frame->setReferrerForRequest(web_request, GURL(custom_referrer_url_)); | 384 frame->setReferrerForRequest(web_request, GURL(custom_referrer_url_)); |
| 385 } else { | 385 } else if (!allow_cross_origin_requests_) { |
| 386 frame->setReferrerForRequest(web_request, WebURL()); // Use default. | 386 // Use default, except for cross-origin requests, since 'referer' is not |
| 387 // whitelisted and will cause the request to fail. |
| 388 frame->setReferrerForRequest(web_request, WebURL()); |
| 387 } | 389 } |
| 388 | 390 |
| 389 if (has_custom_content_transfer_encoding_) { | 391 if (has_custom_content_transfer_encoding_) { |
| 390 if (!custom_content_transfer_encoding_.empty()) { | 392 if (!custom_content_transfer_encoding_.empty()) { |
| 391 web_request.addHTTPHeaderField( | 393 web_request.addHTTPHeaderField( |
| 392 WebString::fromUTF8("Content-Transfer-Encoding"), | 394 WebString::fromUTF8("Content-Transfer-Encoding"), |
| 393 WebString::fromUTF8(custom_content_transfer_encoding_)); | 395 WebString::fromUTF8(custom_content_transfer_encoding_)); |
| 394 } | 396 } |
| 395 } | 397 } |
| 396 | 398 |
| 397 return web_request; | 399 return web_request; |
| 398 } | 400 } |
| 399 | 401 |
| 400 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { | 402 bool PPB_URLRequestInfo_Impl::RequiresUniversalAccess() const { |
| 401 return has_custom_referrer_url_ || has_custom_content_transfer_encoding_; | 403 return has_custom_referrer_url_ || has_custom_content_transfer_encoding_; |
| 402 } | 404 } |
| 403 | 405 |
| 404 } // namespace ppapi | 406 } // namespace ppapi |
| 405 } // namespace webkit | 407 } // namespace webkit |
| OLD | NEW |