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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 | 488 |
489 // Confirm we're in the proper set of states to be here; | 489 // Confirm we're in the proper set of states to be here; |
490 // in in_progress_, have all data, have a history handle, (validated or safe). | 490 // in in_progress_, have all data, have a history handle, (validated or safe). |
491 DCHECK_NE(DownloadItem::DANGEROUS, download->safety_state()); | 491 DCHECK_NE(DownloadItem::DANGEROUS, download->safety_state()); |
492 DCHECK_EQ(1u, in_progress_.count(download->id())); | 492 DCHECK_EQ(1u, in_progress_.count(download->id())); |
493 DCHECK(download->all_data_saved()); | 493 DCHECK(download->all_data_saved()); |
494 DCHECK(download->db_handle() != DownloadItem::kUninitializedHandle); | 494 DCHECK(download->db_handle() != DownloadItem::kUninitializedHandle); |
495 DCHECK_EQ(1u, history_downloads_.count(download->db_handle())); | 495 DCHECK_EQ(1u, history_downloads_.count(download->db_handle())); |
496 | 496 |
497 VLOG(20) << __FUNCTION__ << "()" << " executing: download = " | 497 VLOG(20) << __FUNCTION__ << "()" << " executing: download = " |
498 << download->DebugString(false); | 498 << download->DebugString(false); |
asanka
2011/10/28 19:22:19
Very minor nit: Should this logging happen after c
Randy Smith (Not in Mondays)
2011/10/29 23:10:39
Yeah, I think so. Done.
| |
499 | 499 |
500 // Give the delegate a chance to override. | |
501 if (!delegate_->ShouldCompleteDownload(download)) | |
502 return; | |
503 | |
500 // Remove the id from in_progress | 504 // Remove the id from in_progress |
501 in_progress_.erase(download->id()); | 505 in_progress_.erase(download->id()); |
502 UpdateDownloadProgress(); // Reflect removal from in_progress_. | 506 UpdateDownloadProgress(); // Reflect removal from in_progress_. |
503 | 507 |
504 delegate_->UpdateItemInPersistentStore(download); | 508 delegate_->UpdateItemInPersistentStore(download); |
505 | 509 |
506 // Finish the download. | 510 // Finish the download. |
507 download->OnDownloadCompleting(file_manager_); | 511 download->OnDownloadCompleting(file_manager_); |
508 } | 512 } |
509 | 513 |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1083 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { | 1087 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { |
1084 delegate_->UpdateItemInPersistentStore(download); | 1088 delegate_->UpdateItemInPersistentStore(download); |
1085 int num_unopened = 0; | 1089 int num_unopened = 0; |
1086 for (DownloadMap::iterator it = history_downloads_.begin(); | 1090 for (DownloadMap::iterator it = history_downloads_.begin(); |
1087 it != history_downloads_.end(); ++it) { | 1091 it != history_downloads_.end(); ++it) { |
1088 if (it->second->IsComplete() && !it->second->opened()) | 1092 if (it->second->IsComplete() && !it->second->opened()) |
1089 ++num_unopened; | 1093 ++num_unopened; |
1090 } | 1094 } |
1091 download_stats::RecordOpensOutstanding(num_unopened); | 1095 download_stats::RecordOpensOutstanding(num_unopened); |
1092 } | 1096 } |
OLD | NEW |