Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: chrome/browser/renderer_host/download_resource_handler.cc

Issue 2927006: Option-click to download should not display "Save As" UI. (Closed)
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/renderer_host/download_resource_handler.h" 5 #include "chrome/browser/renderer_host/download_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/download/download_file.h" 9 #include "chrome/browser/download/download_file.h"
10 #include "chrome/browser/download/download_manager.h" 10 #include "chrome/browser/download/download_manager.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 info->request_id = global_id_.request_id; 77 info->request_id = global_id_.request_id;
78 info->content_disposition = content_disposition_; 78 info->content_disposition = content_disposition_;
79 info->mime_type = response->response_head.mime_type; 79 info->mime_type = response->response_head.mime_type;
80 80
81 std::string content_type_header; 81 std::string content_type_header;
82 if (!response->response_head.headers || 82 if (!response->response_head.headers ||
83 !response->response_head.headers->GetMimeType(&content_type_header)) 83 !response->response_head.headers->GetMimeType(&content_type_header))
84 content_type_header = ""; 84 content_type_header = "";
85 info->original_mime_type = content_type_header; 85 info->original_mime_type = content_type_header;
86 86
87 info->save_as = save_as_ && save_info_.file_path.empty(); 87 info->prompt_user_for_save_location =
88 save_as_ && save_info_.file_path.empty();
88 info->is_dangerous = false; 89 info->is_dangerous = false;
89 info->referrer_charset = request_->context()->referrer_charset(); 90 info->referrer_charset = request_->context()->referrer_charset();
90 info->save_info = save_info_; 91 info->save_info = save_info_;
91 ChromeThread::PostTask( 92 ChromeThread::PostTask(
92 ChromeThread::FILE, FROM_HERE, 93 ChromeThread::FILE, FROM_HERE,
93 NewRunnableMethod( 94 NewRunnableMethod(
94 download_manager_, &DownloadFileManager::StartDownload, info)); 95 download_manager_, &DownloadFileManager::StartDownload, info));
95 return true; 96 return true;
96 } 97 }
97 98
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 should_pause); 201 should_pause);
201 is_paused_ = should_pause; 202 is_paused_ = should_pause;
202 } 203 }
203 } 204 }
204 205
205 void DownloadResourceHandler::StartPauseTimer() { 206 void DownloadResourceHandler::StartPauseTimer() {
206 if (!pause_timer_.IsRunning()) 207 if (!pause_timer_.IsRunning())
207 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this, 208 pause_timer_.Start(base::TimeDelta::FromMilliseconds(kThrottleTimeMs), this,
208 &DownloadResourceHandler::CheckWriteProgress); 209 &DownloadResourceHandler::CheckWriteProgress);
209 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698