| 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_loader_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" | 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 WebURLRequest web_request; | 123 WebURLRequest web_request; |
| 124 if (!request->ToWebURLRequest(frame, &web_request)) | 124 if (!request->ToWebURLRequest(frame, &web_request)) |
| 125 return PP_ERROR_FAILED; | 125 return PP_ERROR_FAILED; |
| 126 | 126 |
| 127 // Save a copy of the request info so the plugin can continue to use and | 127 // Save a copy of the request info so the plugin can continue to use and |
| 128 // change it while we're doing the request without affecting us. We must do | 128 // change it while we're doing the request without affecting us. We must do |
| 129 // this after ToWebURLRequest since that fills out the file refs. | 129 // this after ToWebURLRequest since that fills out the file refs. |
| 130 request_data_ = request->GetData(); | 130 request_data_ = request->GetData(); |
| 131 | 131 |
| 132 WebURLLoaderOptions options; | 132 WebURLLoaderOptions options; |
| 133 options.allowCredentials = request_data_.allow_credentials; | |
| 134 if (has_universal_access_) { | 133 if (has_universal_access_) { |
| 134 options.allowCredentials = true; |
| 135 options.crossOriginRequestPolicy = | 135 options.crossOriginRequestPolicy = |
| 136 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; | 136 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; |
| 137 } else { | 137 } else { |
| 138 // All other HTTP requests are untrusted. | 138 // All other HTTP requests are untrusted. |
| 139 options.untrustedHTTP = true; | 139 options.untrustedHTTP = true; |
| 140 options.allowCredentials = request_data_.allow_credentials; |
| 140 if (request_data_.allow_cross_origin_requests) { | 141 if (request_data_.allow_cross_origin_requests) { |
| 141 // Allow cross-origin requests with access control. | 142 // Allow cross-origin requests with access control. |
| 142 options.crossOriginRequestPolicy = | 143 options.crossOriginRequestPolicy = |
| 143 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; | 144 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; |
| 144 } | 145 } |
| 145 } | 146 } |
| 146 | 147 |
| 147 is_asynchronous_load_suspended_ = false; | 148 is_asynchronous_load_suspended_ = false; |
| 148 loader_.reset(frame->createAssociatedURLLoader(options)); | 149 loader_.reset(frame->createAssociatedURLLoader(options)); |
| 149 if (!loader_.get()) | 150 if (!loader_.get()) |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { | 462 bool PPB_URLLoader_Impl::RecordDownloadProgress() const { |
| 462 return request_data_.record_download_progress; | 463 return request_data_.record_download_progress; |
| 463 } | 464 } |
| 464 | 465 |
| 465 bool PPB_URLLoader_Impl::RecordUploadProgress() const { | 466 bool PPB_URLLoader_Impl::RecordUploadProgress() const { |
| 466 return request_data_.record_upload_progress; | 467 return request_data_.record_upload_progress; |
| 467 } | 468 } |
| 468 | 469 |
| 469 } // namespace ppapi | 470 } // namespace ppapi |
| 470 } // namespace webkit | 471 } // namespace webkit |
| OLD | NEW |