OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/download/download_file_manager.h" | 5 #include "chrome/browser/download/download_file_manager.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 const std::string& referrer_charset, | 77 const std::string& referrer_charset, |
78 const DownloadSaveInfo& save_info, | 78 const DownloadSaveInfo& save_info, |
79 int render_process_host_id, | 79 int render_process_host_id, |
80 int render_view_id, | 80 int render_view_id, |
81 URLRequestContextGetter* request_context_getter) { | 81 URLRequestContextGetter* request_context_getter) { |
82 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); | 82 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::IO)); |
83 | 83 |
84 URLRequestContext* context = request_context_getter->GetURLRequestContext(); | 84 URLRequestContext* context = request_context_getter->GetURLRequestContext(); |
85 context->set_referrer_charset(referrer_charset); | 85 context->set_referrer_charset(referrer_charset); |
86 | 86 |
87 // Show "Save As" UI. | |
88 bool prompt_for_save_location = true; | |
89 resource_dispatcher_host_->BeginDownload(url, | 87 resource_dispatcher_host_->BeginDownload(url, |
90 referrer, | 88 referrer, |
91 save_info, | 89 save_info, |
92 prompt_for_save_location, | |
93 render_process_host_id, | 90 render_process_host_id, |
94 render_view_id, | 91 render_view_id, |
95 context); | 92 context); |
96 } | 93 } |
97 | 94 |
98 // Notifications sent from the download thread and run on the UI thread. | 95 // Notifications sent from the download thread and run on the UI thread. |
99 | 96 |
100 // Lookup the DownloadManager for this TabContents' profile and inform it of | 97 // Lookup the DownloadManager for this TabContents' profile and inform it of |
101 // a new download. | 98 // a new download. |
102 // TODO(paulg): When implementing download restart via the Downloads tab, | 99 // TODO(paulg): When implementing download restart via the Downloads tab, |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 delete download; | 498 delete download; |
502 } | 499 } |
503 | 500 |
504 if (downloads_.empty()) { | 501 if (downloads_.empty()) { |
505 ChromeThread::PostTask( | 502 ChromeThread::PostTask( |
506 ChromeThread::UI, FROM_HERE, | 503 ChromeThread::UI, FROM_HERE, |
507 NewRunnableMethod(this, &DownloadFileManager::StopUpdateTimer)); | 504 NewRunnableMethod(this, &DownloadFileManager::StopUpdateTimer)); |
508 } | 505 } |
509 } | 506 } |
510 | 507 |
OLD | NEW |