| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 headers.AddHeadersFromString(params->headers); | 461 headers.AddHeadersFromString(params->headers); |
| 462 request_->SetExtraRequestHeaders(headers); | 462 request_->SetExtraRequestHeaders(headers); |
| 463 request_->set_load_flags(params->load_flags); | 463 request_->set_load_flags(params->load_flags); |
| 464 if (params->request_body.get()) { | 464 if (params->request_body.get()) { |
| 465 request_->set_upload(make_scoped_ptr( | 465 request_->set_upload(make_scoped_ptr( |
| 466 params->request_body->ResolveElementsAndCreateUploadDataStream( | 466 params->request_body->ResolveElementsAndCreateUploadDataStream( |
| 467 static_cast<TestShellRequestContext*>(g_request_context) | 467 static_cast<TestShellRequestContext*>(g_request_context) |
| 468 ->blob_storage_controller(), | 468 ->blob_storage_controller(), |
| 469 static_cast<TestShellRequestContext*>(g_request_context) | 469 static_cast<TestShellRequestContext*>(g_request_context) |
| 470 ->file_system_context(), | 470 ->file_system_context(), |
| 471 base::MessageLoopProxy::current()))); | 471 base::MessageLoopProxy::current().get()))); |
| 472 } | 472 } |
| 473 SimpleAppCacheSystem::SetExtraRequestInfo( | 473 SimpleAppCacheSystem::SetExtraRequestInfo( |
| 474 request_.get(), params->appcache_host_id, params->request_type); | 474 request_.get(), params->appcache_host_id, params->request_type); |
| 475 | 475 |
| 476 download_to_file_ = params->download_to_file; | 476 download_to_file_ = params->download_to_file; |
| 477 if (download_to_file_) { | 477 if (download_to_file_) { |
| 478 base::FilePath path; | 478 base::FilePath path; |
| 479 if (file_util::CreateTemporaryFile(&path)) { | 479 if (file_util::CreateTemporaryFile(&path)) { |
| 480 downloaded_file_ = ShareableFileReference::GetOrCreate( | 480 downloaded_file_ = ShareableFileReference::GetOrCreate( |
| 481 path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, | 481 path, |
| 482 base::MessageLoopProxy::current()); | 482 ShareableFileReference::DELETE_ON_FINAL_RELEASE, |
| 483 base::MessageLoopProxy::current().get()); |
| 483 file_stream_.reset(new net::FileStream(NULL)); | 484 file_stream_.reset(new net::FileStream(NULL)); |
| 484 file_stream_->OpenSync( | 485 file_stream_->OpenSync( |
| 485 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); | 486 path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); |
| 486 } | 487 } |
| 487 } | 488 } |
| 488 | 489 |
| 489 request_->Start(); | 490 request_->Start(); |
| 490 | 491 |
| 491 if (request_->has_upload() && | 492 if (request_->has_upload() && |
| 492 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { | 493 params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 if (!g_file_over_http_mappings) | 1160 if (!g_file_over_http_mappings) |
| 1160 g_file_over_http_mappings = new FileOverHTTPPathMappings(); | 1161 g_file_over_http_mappings = new FileOverHTTPPathMappings(); |
| 1161 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix); | 1162 g_file_over_http_mappings->AddMapping(file_path_template, http_prefix); |
| 1162 } | 1163 } |
| 1163 | 1164 |
| 1164 // static | 1165 // static |
| 1165 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( | 1166 webkit_glue::ResourceLoaderBridge* SimpleResourceLoaderBridge::Create( |
| 1166 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { | 1167 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) { |
| 1167 return new ResourceLoaderBridgeImpl(request_info); | 1168 return new ResourceLoaderBridgeImpl(request_info); |
| 1168 } | 1169 } |
| OLD | NEW |