summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 18:49:58 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 18:49:58 +0000
commit6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1 (patch)
tree8e833c393312e866250077c15bc1d90464fe99d7 /chrome/browser/renderer_host
parent963dfb5a05c5b0e3fa8ed74d803f01cb10fd455e (diff)
downloadchromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.zip
chromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.tar.gz
chromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.tar.bz2
Support dragging a virtual file out of the browser.
BUG=none TEST=none Review URL: http://codereview.chromium.org/351029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.cc7
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.h5
-rw-r--r--chrome/browser/renderer_host/download_throttling_resource_handler.cc4
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc4
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h1
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc2
6 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc
index 6c64396..e414587 100644
--- a/chrome/browser/renderer_host/download_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_resource_handler.cc
@@ -20,7 +20,8 @@ DownloadResourceHandler::DownloadResourceHandler(ResourceDispatcherHost* rdh,
const GURL& url,
DownloadFileManager* manager,
URLRequest* request,
- bool save_as)
+ bool save_as,
+ const FilePath& save_file_path)
: download_id_(-1),
global_id_(render_process_host_id, request_id),
render_view_id_(render_view_id),
@@ -29,6 +30,7 @@ DownloadResourceHandler::DownloadResourceHandler(ResourceDispatcherHost* rdh,
download_manager_(manager),
request_(request),
save_as_(save_as),
+ save_file_path_(save_file_path),
buffer_(new DownloadBuffer),
rdh_(rdh),
is_paused_(false) {
@@ -67,9 +69,10 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
info->request_id = global_id_.request_id;
info->content_disposition = content_disposition_;
info->mime_type = response->response_head.mime_type;
- info->save_as = save_as_;
+ info->save_as = save_as_ && save_file_path_.empty();
info->is_dangerous = false;
info->referrer_charset = request_->context()->referrer_charset();
+ info->save_file_path = save_file_path_;
ChromeThread::PostTask(
ChromeThread::FILE, FROM_HERE,
NewRunnableMethod(
diff --git a/chrome/browser/renderer_host/download_resource_handler.h b/chrome/browser/renderer_host/download_resource_handler.h
index 24251f6..59b4cb4 100644
--- a/chrome/browser/renderer_host/download_resource_handler.h
+++ b/chrome/browser/renderer_host/download_resource_handler.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/file_path.h"
#include "base/timer.h"
#include "chrome/browser/renderer_host/global_request_id.h"
#include "chrome/browser/renderer_host/resource_handler.h"
@@ -26,7 +27,8 @@ class DownloadResourceHandler : public ResourceHandler {
const GURL& url,
DownloadFileManager* manager,
URLRequest* request,
- bool save_as);
+ bool save_as,
+ const FilePath& save_file_path);
// Not needed, as this event handler ought to be the final resource.
bool OnRequestRedirected(int request_id, const GURL& url,
@@ -70,6 +72,7 @@ class DownloadResourceHandler : public ResourceHandler {
DownloadFileManager* download_manager_;
URLRequest* request_;
bool save_as_; // Request was initiated via "Save As" by the user.
+ FilePath save_file_path_;
DownloadBuffer* buffer_;
ResourceDispatcherHost* rdh_;
bool is_paused_;
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.cc b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
index 8ca251f..4b02880 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.cc
@@ -130,6 +130,7 @@ void DownloadThrottlingResourceHandler::CancelDownload() {
void DownloadThrottlingResourceHandler::ContinueDownload() {
DCHECK(!download_handler_.get());
+ FilePath save_file_path;
download_handler_ =
new DownloadResourceHandler(host_,
render_process_host_id_,
@@ -138,7 +139,8 @@ void DownloadThrottlingResourceHandler::ContinueDownload() {
url_,
host_->download_file_manager(),
request_,
- false);
+ false,
+ save_file_path);
if (response_.get())
download_handler_->OnResponseStarted(request_id_, response_.get());
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index b6db297..19096a4 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -648,6 +648,7 @@ void ResourceDispatcherHost::OnClosePageACK(
// We are explicitly forcing the download of 'url'.
void ResourceDispatcherHost::BeginDownload(const GURL& url,
const GURL& referrer,
+ const FilePath& save_file_path,
int child_id,
int route_id,
URLRequestContext* request_context) {
@@ -677,7 +678,8 @@ void ResourceDispatcherHost::BeginDownload(const GURL& url,
url,
download_file_manager_.get(),
request,
- true);
+ true,
+ save_file_path);
if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(url)) {
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index da043eb..3f2816d 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -108,6 +108,7 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// request from the renderer or another child process).
void BeginDownload(const GURL& url,
const GURL& referrer,
+ const FilePath& save_file_path,
int process_unique_id,
int route_id,
URLRequestContext* request_context);
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index eafa767..b6ece5c 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -684,8 +684,10 @@ void ResourceMessageFilter::OnDownloadUrl(const IPC::Message& message,
const GURL& url,
const GURL& referrer) {
URLRequestContext* context = request_context_->GetURLRequestContext();
+ FilePath save_file_path;
resource_dispatcher_host_->BeginDownload(url,
referrer,
+ save_file_path,
id(),
message.routing_id(),
context);