| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download_file_manager.h" | 5 #include "content/browser/download/download_file_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 132 DCHECK(info); | 132 DCHECK(info); |
| 133 | 133 |
| 134 DownloadManager* manager = request_handle.GetDownloadManager(); | 134 DownloadManager* manager = request_handle.GetDownloadManager(); |
| 135 if (!manager) { | 135 if (!manager) { |
| 136 request_handle.CancelRequest(); | 136 request_handle.CancelRequest(); |
| 137 delete info; | 137 delete info; |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 | 140 |
| 141 // TODO(phajdan.jr): fix the duplication of path info below. | |
| 142 info->path = info->save_info.file_path; | |
| 143 | |
| 144 manager->CreateDownloadItem(info, request_handle); | 141 manager->CreateDownloadItem(info, request_handle); |
| 145 bool hash_needed = manager->delegate()->GenerateFileHash(); | 142 bool hash_needed = manager->delegate()->GenerateFileHash(); |
| 146 | 143 |
| 147 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 144 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| 148 base::Bind(&DownloadFileManager::CreateDownloadFile, this, | 145 base::Bind(&DownloadFileManager::CreateDownloadFile, this, |
| 149 info, request_handle, make_scoped_refptr(manager), | 146 info, request_handle, make_scoped_refptr(manager), |
| 150 hash_needed)); | 147 hash_needed)); |
| 151 } | 148 } |
| 152 | 149 |
| 153 // We don't forward an update to the UI thread here, since we want to throttle | 150 // We don't forward an update to the UI thread here, since we want to throttle |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 << " id = " << global_id | 423 << " id = " << global_id |
| 427 << " download_file = " << download_file->DebugString(); | 424 << " download_file = " << download_file->DebugString(); |
| 428 | 425 |
| 429 downloads_.erase(global_id); | 426 downloads_.erase(global_id); |
| 430 | 427 |
| 431 delete download_file; | 428 delete download_file; |
| 432 | 429 |
| 433 if (downloads_.empty()) | 430 if (downloads_.empty()) |
| 434 StopUpdateTimer(); | 431 StopUpdateTimer(); |
| 435 } | 432 } |
| OLD | NEW |