| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/download/drag_download_file.h" | 5 #include "content/browser/download/drag_download_file.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void InitiateDownload(base::File file, | 61 void InitiateDownload(base::File file, |
| 62 const base::FilePath& file_path) { | 62 const base::FilePath& file_path) { |
| 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 63 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 64 DownloadManager* download_manager = | 64 DownloadManager* download_manager = |
| 65 BrowserContext::GetDownloadManager(web_contents_->GetBrowserContext()); | 65 BrowserContext::GetDownloadManager(web_contents_->GetBrowserContext()); |
| 66 | 66 |
| 67 RecordDownloadSource(INITIATED_BY_DRAG_N_DROP); | 67 RecordDownloadSource(INITIATED_BY_DRAG_N_DROP); |
| 68 std::unique_ptr<content::DownloadUrlParameters> params( | 68 std::unique_ptr<content::DownloadUrlParameters> params( |
| 69 DownloadUrlParameters::FromWebContents(web_contents_, url_)); | 69 DownloadUrlParameters::CreateForWebContentsMainFrame( |
| 70 web_contents_, url_)); |
| 70 params->set_referrer(referrer_); | 71 params->set_referrer(referrer_); |
| 71 params->set_referrer_encoding(referrer_encoding_); | 72 params->set_referrer_encoding(referrer_encoding_); |
| 72 params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted, | 73 params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted, |
| 73 weak_ptr_factory_.GetWeakPtr())); | 74 weak_ptr_factory_.GetWeakPtr())); |
| 74 params->set_file_path(file_path); | 75 params->set_file_path(file_path); |
| 75 params->set_file(std::move(file)); // Nulls file. | 76 params->set_file(std::move(file)); // Nulls file. |
| 76 download_manager->DownloadUrl(std::move(params)); | 77 download_manager->DownloadUrl(std::move(params)); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void Cancel() { | 80 void Cancel() { |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 242 |
| 242 void DragDownloadFile::CheckThread() { | 243 void DragDownloadFile::CheckThread() { |
| 243 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
| 244 DCHECK(drag_message_loop_ == base::MessageLoop::current()); | 245 DCHECK(drag_message_loop_ == base::MessageLoop::current()); |
| 245 #else | 246 #else |
| 246 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 247 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 247 #endif | 248 #endif |
| 248 } | 249 } |
| 249 | 250 |
| 250 } // namespace content | 251 } // namespace content |
| OLD | NEW |