| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains an implementation of the ResourceLoaderBridge class. | 5 // This file contains an implementation of the ResourceLoaderBridge class. |
| 6 // The class is implemented using net::URLRequest, meaning it is a "simple" | 6 // The class is implemented using net::URLRequest, meaning it is a "simple" |
| 7 // version that directly issues requests. The more complicated one used in the | 7 // version that directly issues requests. The more complicated one used in the |
| 8 // browser uses IPC. | 8 // browser uses IPC. |
| 9 // | 9 // |
| 10 // Because net::URLRequest only provides an asynchronous resource loading API, | 10 // Because net::URLRequest only provides an asynchronous resource loading API, |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // actions performed on the owner's thread. | 405 // actions performed on the owner's thread. |
| 406 | 406 |
| 407 void AsyncStart(RequestParams* params) { | 407 void AsyncStart(RequestParams* params) { |
| 408 // Might need to resolve the blob references in the upload data. | 408 // Might need to resolve the blob references in the upload data. |
| 409 if (params->upload) { | 409 if (params->upload) { |
| 410 static_cast<TestShellRequestContext*>(g_request_context)-> | 410 static_cast<TestShellRequestContext*>(g_request_context)-> |
| 411 blob_storage_controller()->ResolveBlobReferencesInUploadData( | 411 blob_storage_controller()->ResolveBlobReferencesInUploadData( |
| 412 params->upload.get()); | 412 params->upload.get()); |
| 413 } | 413 } |
| 414 | 414 |
| 415 request_.reset(new net::URLRequest(params->url, this)); | 415 request_.reset(new net::URLRequest(params->url, this, g_request_context)); |
| 416 request_->set_method(params->method); | 416 request_->set_method(params->method); |
| 417 request_->set_first_party_for_cookies(params->first_party_for_cookies); | 417 request_->set_first_party_for_cookies(params->first_party_for_cookies); |
| 418 request_->set_referrer(params->referrer.spec()); | 418 request_->set_referrer(params->referrer.spec()); |
| 419 webkit_glue::ConfigureURLRequestForReferrerPolicy( | 419 webkit_glue::ConfigureURLRequestForReferrerPolicy( |
| 420 request_.get(), params->referrer_policy); | 420 request_.get(), params->referrer_policy); |
| 421 net::HttpRequestHeaders headers; | 421 net::HttpRequestHeaders headers; |
| 422 headers.AddHeadersFromString(params->headers); | 422 headers.AddHeadersFromString(params->headers); |
| 423 request_->SetExtraRequestHeaders(headers); | 423 request_->SetExtraRequestHeaders(headers); |
| 424 request_->set_load_flags(params->load_flags); | 424 request_->set_load_flags(params->load_flags); |
| 425 request_->set_upload(params->upload.get()); | 425 request_->set_upload(params->upload.get()); |
| 426 request_->set_context(g_request_context); | |
| 427 SimpleAppCacheSystem::SetExtraRequestInfo( | 426 SimpleAppCacheSystem::SetExtraRequestInfo( |
| 428 request_.get(), params->appcache_host_id, params->request_type); | 427 request_.get(), params->appcache_host_id, params->request_type); |
| 429 | 428 |
| 430 download_to_file_ = params->download_to_file; | 429 download_to_file_ = params->download_to_file; |
| 431 if (download_to_file_) { | 430 if (download_to_file_) { |
| 432 FilePath path; | 431 FilePath path; |
| 433 if (file_util::CreateTemporaryFile(&path)) { | 432 if (file_util::CreateTemporaryFile(&path)) { |
| 434 downloaded_file_ = ShareableFileReference::GetOrCreate( | 433 downloaded_file_ = ShareableFileReference::GetOrCreate( |
| 435 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 434 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
| 436 base::MessageLoopProxy::current()); | 435 base::MessageLoopProxy::current()); |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1127 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
| 1129 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1128 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
| 1130 http_prefix); | 1129 http_prefix); |
| 1131 } | 1130 } |
| 1132 | 1131 |
| 1133 // static | 1132 // static |
| 1134 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1133 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
| 1135 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1134 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
| 1136 return new ResourceLoaderBridgeImpl(request_info); | 1135 return new ResourceLoaderBridgeImpl(request_info); |
| 1137 } | 1136 } |
| OLD | NEW |