Index: webkit/tools/test_shell/simple_resource_loader_bridge.cc |
=================================================================== |
--- webkit/tools/test_shell/simple_resource_loader_bridge.cc (revision 60424) |
+++ webkit/tools/test_shell/simple_resource_loader_bridge.cc (working copy) |
@@ -33,10 +33,8 @@ |
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h" |
#include "base/file_path.h" |
-#include "base/file_util.h" |
#include "base/logging.h" |
#include "base/message_loop.h" |
-#include "base/message_loop_proxy.h" |
#if defined(OS_MACOSX) || defined(OS_WIN) |
#include "base/nss_util.h" |
#endif |
@@ -46,7 +44,6 @@ |
#include "base/thread.h" |
#include "base/waitable_event.h" |
#include "net/base/cookie_store.h" |
-#include "net/base/file_stream.h" |
#include "net/base/io_buffer.h" |
#include "net/base/load_flags.h" |
#include "net/base/net_errors.h" |
@@ -65,7 +62,6 @@ |
#include "webkit/appcache/appcache_interfaces.h" |
#include "webkit/blob/blob_storage_controller.h" |
#include "webkit/blob/blob_url_request_job.h" |
-#include "webkit/blob/deletable_file_reference.h" |
#include "webkit/glue/resource_loader_bridge.h" |
#include "webkit/tools/test_shell/simple_appcache_system.h" |
#include "webkit/tools/test_shell/simple_socket_stream_bridge.h" |
@@ -75,7 +71,6 @@ |
using webkit_glue::ResourceLoaderBridge; |
using net::StaticCookiePolicy; |
using net::HttpResponseHeaders; |
-using webkit_blob::DeletableFileReference; |
namespace { |
@@ -179,7 +174,6 @@ |
int load_flags; |
ResourceType::Type request_type; |
int appcache_host_id; |
- bool download_to_file; |
scoped_refptr<net::UploadData> upload; |
}; |
@@ -194,8 +188,7 @@ |
public: |
// Takes ownership of the params. |
RequestProxy() |
- : download_to_file_(false), |
- buf_(new net::IOBuffer(kDataSize)), |
+ : buf_(new net::IOBuffer(kDataSize)), |
last_upload_position_(0) { |
} |
@@ -274,17 +267,6 @@ |
peer_->OnReceivedData(buf_copy.get(), bytes_read); |
} |
- void NotifyDownloadedData(int bytes_read) { |
- if (!peer_) |
- return; |
- |
- // Continue reading more data, see the comment in NotifyReceivedData. |
- g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( |
- this, &RequestProxy::AsyncReadData)); |
- |
- peer_->OnDownloadedData(bytes_read); |
- } |
- |
void NotifyCompletedRequest(const URLRequestStatus& status, |
const std::string& security_info, |
const base::Time& complete_time) { |
@@ -324,17 +306,6 @@ |
SimpleAppCacheSystem::SetExtraRequestInfo( |
request_.get(), params->appcache_host_id, params->request_type); |
- download_to_file_ = params->download_to_file; |
- if (download_to_file_) { |
- FilePath path; |
- if (file_util::CreateTemporaryFile(&path)) { |
- downloaded_file_ = DeletableFileReference::GetOrCreate( |
- path, base::MessageLoopProxy::CreateForCurrentThread()); |
- file_stream_.Open( |
- path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); |
- } |
- } |
- |
request_->Start(); |
if (request_->has_upload() && |
@@ -406,13 +377,6 @@ |
} |
virtual void OnReceivedData(int bytes_read) { |
- if (download_to_file_) { |
- file_stream_.Write(buf_->data(), bytes_read, NULL); |
- owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
- this, &RequestProxy::NotifyDownloadedData, bytes_read)); |
- return; |
- } |
- |
owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
this, &RequestProxy::NotifyReceivedData, bytes_read)); |
} |
@@ -420,8 +384,6 @@ |
virtual void OnCompletedRequest(const URLRequestStatus& status, |
const std::string& security_info, |
const base::Time& complete_time) { |
- if (download_to_file_) |
- file_stream_.Close(); |
owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( |
this, |
&RequestProxy::NotifyCompletedRequest, |
@@ -524,8 +486,6 @@ |
request->GetMimeType(&info->mime_type); |
request->GetCharset(&info->charset); |
info->content_length = request->GetExpectedContentSize(); |
- if (downloaded_file_) |
- info->download_file_path = downloaded_file_->path(); |
SimpleAppCacheSystem::GetExtraResponseInfo( |
request, |
&info->appcache_id, |
@@ -534,11 +494,6 @@ |
scoped_ptr<URLRequest> request_; |
- // Support for request.download_to_file behavior. |
- bool download_to_file_; |
- net::FileStream file_stream_; |
- scoped_refptr<DeletableFileReference> downloaded_file_; |
- |
// Size of our async IO data buffers |
static const int kDataSize = 16*1024; |
@@ -598,18 +553,13 @@ |
} |
virtual void OnReceivedData(int bytes_read) { |
- if (download_to_file_) |
- file_stream_.Write(buf_->data(), bytes_read, NULL); |
- else |
- result_->data.append(buf_->data(), bytes_read); |
+ result_->data.append(buf_->data(), bytes_read); |
AsyncReadData(); // read more (may recurse) |
} |
virtual void OnCompletedRequest(const URLRequestStatus& status, |
const std::string& security_info, |
const base::Time& complete_time) { |
- if (download_to_file_) |
- file_stream_.Close(); |
result_->status = status; |
event_.Signal(); |
} |
@@ -627,6 +577,7 @@ |
const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) |
: params_(new RequestParams), |
proxy_(NULL) { |
+ DCHECK(!request_info.download_to_file); // Not implemented yet! |
params_->method = request_info.method; |
params_->url = request_info.url; |
params_->first_party_for_cookies = request_info.first_party_for_cookies; |
@@ -635,7 +586,6 @@ |
params_->load_flags = request_info.load_flags; |
params_->request_type = request_info.request_type; |
params_->appcache_host_id = request_info.appcache_host_id; |
- params_->download_to_file = request_info.download_to_file; |
} |
virtual ~ResourceLoaderBridgeImpl() { |