summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-18 10:54:29 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-18 10:54:29 +0000
commit73f6547f0262578a96ab478c5d9e7f841e39d13e (patch)
treeb41320df4b78ee5b54e1bb5306eacf2f1726cf9b
parente6be47fb2071a5b0e1859eb014cde64f6c78eb5a (diff)
downloadchromium_src-73f6547f0262578a96ab478c5d9e7f841e39d13e.zip
chromium_src-73f6547f0262578a96ab478c5d9e7f841e39d13e.tar.gz
chromium_src-73f6547f0262578a96ab478c5d9e7f841e39d13e.tar.bz2
Revert r52848 - Linux x64 compile failure.
Review URL: http://codereview.chromium.org/3012008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52849 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/download/download_file_manager.cc3
-rw-r--r--chrome/browser/download/download_manager.cc23
-rw-r--r--chrome/browser/history/download_types.h11
-rw-r--r--chrome/browser/renderer_host/download_resource_handler.cc3
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc3
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h1
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.cc4
7 files changed, 15 insertions, 33 deletions
diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc
index 04336cf..90a95f4 100644
--- a/chrome/browser/download/download_file_manager.cc
+++ b/chrome/browser/download/download_file_manager.cc
@@ -84,12 +84,9 @@ void DownloadFileManager::OnDownloadUrl(
URLRequestContext* context = request_context_getter->GetURLRequestContext();
context->set_referrer_charset(referrer_charset);
- // Show "Save As" UI.
- bool prompt_for_save_location = true;
resource_dispatcher_host_->BeginDownload(url,
referrer,
save_info,
- prompt_for_save_location,
render_process_host_id,
render_view_id,
context);
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 622d108..26d1d54 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -404,8 +404,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
DCHECK(info);
// Check whether this download is for an extension install or not.
- // Allow extensions to be explicitly saved.
- if (!info->prompt_user_for_save_location) {
+ if (!info->save_as) { // Allow extensions to be explicitly saved.
if (UserScript::HasUserScriptFileExtension(info->url) ||
info->mime_type == Extension::kMimeType)
info->is_extension_install = true;
@@ -427,13 +426,13 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
// opened, don't bother asking where to keep it.
if (!info->is_extension_install &&
!ShouldOpenFileBasedOnExtension(generated_name))
- info->prompt_user_for_save_location = true;
+ info->save_as = true;
}
// Determine the proper path for a download, by either one of the following:
// 1) using the default download directory.
// 2) prompting the user.
- if (info->prompt_user_for_save_location && !last_download_path_.empty())
+ if (info->save_as && !last_download_path_.empty())
info->suggested_path = last_download_path_;
else
info->suggested_path = download_path();
@@ -442,8 +441,7 @@ void DownloadManager::StartDownload(DownloadCreateInfo* info) {
info->suggested_path = info->save_info.file_path;
}
- if (!info->prompt_user_for_save_location &&
- info->save_info.file_path.empty()) {
+ if (!info->save_as && info->save_info.file_path.empty()) {
// Downloads can be marked as dangerous for two reasons:
// a) They have a dangerous-looking filename
// b) They are an extension that is not from the gallery
@@ -472,7 +470,7 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
FilePath dir = info->suggested_path.DirName();
FilePath filename = info->suggested_path.BaseName();
if (!file_util::PathIsWritable(dir)) {
- info->prompt_user_for_save_location = true;
+ info->save_as = true;
PathService::Get(chrome::DIR_USER_DOCUMENTS, &info->suggested_path);
info->suggested_path = info->suggested_path.Append(filename);
}
@@ -509,12 +507,11 @@ void DownloadManager::CheckIfSuggestedPathExists(DownloadCreateInfo* info) {
info->path_uniquifier = 0;
} else if (info->path_uniquifier == -1) {
// We failed to find a unique path. We have to prompt the user.
- info->prompt_user_for_save_location = true;
+ info->save_as = true;
}
}
- if (!info->prompt_user_for_save_location &&
- info->save_info.file_path.empty()) {
+ if (!info->save_as && info->save_info.file_path.empty()) {
// Create an empty file at the suggested path so that we don't allocate the
// same "non-existant" path to multiple downloads.
// See: http://code.google.com/p/chromium/issues/detail?id=3662
@@ -533,7 +530,7 @@ void DownloadManager::OnPathExistenceAvailable(DownloadCreateInfo* info) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
DCHECK(info);
- if (info->prompt_user_for_save_location) {
+ if (info->save_as) {
// We must ask the user for the place to put the download.
if (!select_file_dialog_.get())
select_file_dialog_ = SelectFileDialog::Create(this);
@@ -580,7 +577,7 @@ void DownloadManager::ContinueStartDownload(DownloadCreateInfo* info,
info->child_id,
info->request_id,
info->is_dangerous,
- info->prompt_user_for_save_location,
+ info->save_as,
profile_->IsOffTheRecord(),
info->is_extension_install,
!info->save_info.file_path.empty());
@@ -1413,7 +1410,7 @@ void DownloadManager::SaveAutoOpens() {
void DownloadManager::FileSelected(const FilePath& path,
int index, void* params) {
DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params);
- if (info->prompt_user_for_save_location)
+ if (info->save_as)
last_download_path_ = path.DirName();
ContinueStartDownload(info, path);
}
diff --git a/chrome/browser/history/download_types.h b/chrome/browser/history/download_types.h
index 642ac5b..4db21e4 100644
--- a/chrome/browser/history/download_types.h
+++ b/chrome/browser/history/download_types.h
@@ -39,7 +39,7 @@ struct DownloadCreateInfo {
render_view_id(-1),
request_id(-1),
db_handle(0),
- prompt_user_for_save_location(false),
+ save_as(false),
is_dangerous(false),
is_extension_install(false) {
}
@@ -54,7 +54,7 @@ struct DownloadCreateInfo {
render_view_id(-1),
request_id(-1),
db_handle(0),
- prompt_user_for_save_location(false),
+ save_as(false),
is_dangerous(false),
is_extension_install(false) {
}
@@ -82,12 +82,7 @@ struct DownloadCreateInfo {
// may be different from |mime_type|, which may be set based on heuristics
// which may look at the file extension and first few bytes of the file.
std::string original_mime_type;
-
- // True if we should display the 'save as...' UI and prompt the user
- // for the download location.
- // False if the UI should be supressed and the download performed to the
- // default location.
- bool prompt_user_for_save_location;
+ bool save_as;
// Whether this download is potentially dangerous (ex: exe, dll, ...).
bool is_dangerous;
// The original name for a dangerous download.
diff --git a/chrome/browser/renderer_host/download_resource_handler.cc b/chrome/browser/renderer_host/download_resource_handler.cc
index 735a168..0b45695 100644
--- a/chrome/browser/renderer_host/download_resource_handler.cc
+++ b/chrome/browser/renderer_host/download_resource_handler.cc
@@ -85,8 +85,7 @@ bool DownloadResourceHandler::OnResponseStarted(int request_id,
content_type_header = "";
info->original_mime_type = content_type_header;
- info->prompt_user_for_save_location =
- save_as_ && save_info_.file_path.empty();
+ info->save_as = save_as_ && save_info_.file_path.empty();
info->is_dangerous = false;
info->referrer_charset = request_->context()->referrer_charset();
info->save_info = save_info_;
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index d3e80c8..cca59a1 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -599,7 +599,6 @@ void ResourceDispatcherHost::BeginDownload(
const GURL& url,
const GURL& referrer,
const DownloadSaveInfo& save_info,
- bool prompt_for_save_location,
int child_id,
int route_id,
URLRequestContext* request_context) {
@@ -629,7 +628,7 @@ void ResourceDispatcherHost::BeginDownload(
url,
download_file_manager_.get(),
request,
- prompt_for_save_location,
+ true,
save_info);
if (safe_browsing_->enabled()) {
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 46dd9c4..00d19e0 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -109,7 +109,6 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
void BeginDownload(const GURL& url,
const GURL& referrer,
const DownloadSaveInfo& save_info,
- bool prompt_for_save_location,
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 698e385..0418487 100644
--- a/chrome/browser/renderer_host/resource_message_filter.cc
+++ b/chrome/browser/renderer_host/resource_message_filter.cc
@@ -871,13 +871,9 @@ void ResourceMessageFilter::OnDownloadUrl(const IPC::Message& message,
const GURL& url,
const GURL& referrer) {
URLRequestContext* context = request_context_->GetURLRequestContext();
-
- // Don't show "Save As" UI.
- bool prompt_for_save_location = false;
resource_dispatcher_host_->BeginDownload(url,
referrer,
DownloadSaveInfo(),
- prompt_for_save_location,
id(),
message.routing_id(),
context);