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_manager.h" | 5 #include "content/browser/download/download_manager.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 contents, suggested_path, reinterpret_cast<void*>(id_ptr)); | 318 contents, suggested_path, reinterpret_cast<void*>(id_ptr)); |
319 | 319 |
320 FOR_EACH_OBSERVER(Observer, observers_, | 320 FOR_EACH_OBSERVER(Observer, observers_, |
321 SelectFileDialogDisplayed(download_id)); | 321 SelectFileDialogDisplayed(download_id)); |
322 } else { | 322 } else { |
323 // No prompting for download, just continue with the suggested name. | 323 // No prompting for download, just continue with the suggested name. |
324 ContinueDownloadWithPath(download, suggested_path); | 324 ContinueDownloadWithPath(download, suggested_path); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 void DownloadManager::CreateDownloadItem(DownloadCreateInfo* info) { | 328 void DownloadManager::CreateDownloadItem( |
| 329 DownloadCreateInfo* info, const DownloadRequestHandle& request_handle) { |
329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 330 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
330 | 331 |
331 DownloadItem* download = new DownloadItem(this, *info, | 332 DownloadItem* download = new DownloadItem(this, *info, |
| 333 request_handle, |
332 browser_context_->IsOffTheRecord()); | 334 browser_context_->IsOffTheRecord()); |
333 int32 download_id = info->download_id; | 335 int32 download_id = info->download_id; |
334 DCHECK(!ContainsKey(in_progress_, download_id)); | 336 DCHECK(!ContainsKey(in_progress_, download_id)); |
335 | 337 |
336 // TODO(rdsmith): Remove after http://crbug.com/85408 resolved. | 338 // TODO(rdsmith): Remove after http://crbug.com/85408 resolved. |
337 CHECK(!ContainsKey(active_downloads_, download_id)); | 339 CHECK(!ContainsKey(active_downloads_, download_id)); |
338 downloads_.insert(download); | 340 downloads_.insert(download); |
339 active_downloads_[download_id] = download; | 341 active_downloads_[download_id] = download; |
340 } | 342 } |
341 | 343 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { | 1085 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { |
1084 delegate_->UpdateItemInPersistentStore(download); | 1086 delegate_->UpdateItemInPersistentStore(download); |
1085 int num_unopened = 0; | 1087 int num_unopened = 0; |
1086 for (DownloadMap::iterator it = history_downloads_.begin(); | 1088 for (DownloadMap::iterator it = history_downloads_.begin(); |
1087 it != history_downloads_.end(); ++it) { | 1089 it != history_downloads_.end(); ++it) { |
1088 if (it->second->IsComplete() && !it->second->opened()) | 1090 if (it->second->IsComplete() && !it->second->opened()) |
1089 ++num_unopened; | 1091 ++num_unopened; |
1090 } | 1092 } |
1091 download_stats::RecordOpensOutstanding(num_unopened); | 1093 download_stats::RecordOpensOutstanding(num_unopened); |
1092 } | 1094 } |
OLD | NEW |