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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 // actions performed on the owner's thread. | 410 // actions performed on the owner's thread. |
411 | 411 |
412 void AsyncStart(RequestParams* params) { | 412 void AsyncStart(RequestParams* params) { |
413 // Might need to resolve the blob references in the upload data. | 413 // Might need to resolve the blob references in the upload data. |
414 if (params->upload) { | 414 if (params->upload) { |
415 static_cast<TestShellRequestContext*>(g_request_context)-> | 415 static_cast<TestShellRequestContext*>(g_request_context)-> |
416 blob_storage_controller()->ResolveBlobReferencesInUploadData( | 416 blob_storage_controller()->ResolveBlobReferencesInUploadData( |
417 params->upload.get()); | 417 params->upload.get()); |
418 } | 418 } |
419 | 419 |
420 request_.reset(new net::URLRequest(params->url, this)); | 420 request_.reset(new net::URLRequest(params->url, this, g_request_context)); |
421 request_->set_method(params->method); | 421 request_->set_method(params->method); |
422 request_->set_first_party_for_cookies(params->first_party_for_cookies); | 422 request_->set_first_party_for_cookies(params->first_party_for_cookies); |
423 request_->set_referrer(params->referrer.spec()); | 423 request_->set_referrer(params->referrer.spec()); |
424 webkit_glue::ConfigureURLRequestForReferrerPolicy( | 424 webkit_glue::ConfigureURLRequestForReferrerPolicy( |
425 request_.get(), params->referrer_policy); | 425 request_.get(), params->referrer_policy); |
426 net::HttpRequestHeaders headers; | 426 net::HttpRequestHeaders headers; |
427 headers.AddHeadersFromString(params->headers); | 427 headers.AddHeadersFromString(params->headers); |
428 request_->SetExtraRequestHeaders(headers); | 428 request_->SetExtraRequestHeaders(headers); |
429 request_->set_load_flags(params->load_flags); | 429 request_->set_load_flags(params->load_flags); |
430 request_->set_upload(params->upload.get()); | 430 request_->set_upload(params->upload.get()); |
431 request_->set_context(g_request_context); | |
432 SimpleAppCacheSystem::SetExtraRequestInfo( | 431 SimpleAppCacheSystem::SetExtraRequestInfo( |
433 request_.get(), params->appcache_host_id, params->request_type); | 432 request_.get(), params->appcache_host_id, params->request_type); |
434 | 433 |
435 download_to_file_ = params->download_to_file; | 434 download_to_file_ = params->download_to_file; |
436 if (download_to_file_) { | 435 if (download_to_file_) { |
437 FilePath path; | 436 FilePath path; |
438 if (file_util::CreateTemporaryFile(&path)) { | 437 if (file_util::CreateTemporaryFile(&path)) { |
439 downloaded_file_ = ShareableFileReference::GetOrCreate( | 438 downloaded_file_ = ShareableFileReference::GetOrCreate( |
440 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 439 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
441 base::MessageLoopProxy::current()); | 440 base::MessageLoopProxy::current()); |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); | 1130 (http_prefix.SchemeIs("http") || http_prefix.SchemeIs("https"))); |
1132 g_file_over_http_params = new FileOverHTTPParams(file_path_template, | 1131 g_file_over_http_params = new FileOverHTTPParams(file_path_template, |
1133 http_prefix); | 1132 http_prefix); |
1134 } | 1133 } |
1135 | 1134 |
1136 // static | 1135 // static |
1137 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1136 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
1138 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1137 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
1139 return new ResourceLoaderBridgeImpl(request_info); | 1138 return new ResourceLoaderBridgeImpl(request_info); |
1140 } | 1139 } |
OLD | NEW |