| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 int32 download_id = download->id(); | 338 int32 download_id = download->id(); |
| 339 | 339 |
| 340 // NOTE(ahendrickson) Eventually |active_downloads_| will replace | 340 // NOTE(ahendrickson) Eventually |active_downloads_| will replace |
| 341 // |in_progress_|, but we don't want to change the semantics yet. | 341 // |in_progress_|, but we don't want to change the semantics yet. |
| 342 DCHECK(!ContainsKey(in_progress_, download_id)); | 342 DCHECK(!ContainsKey(in_progress_, download_id)); |
| 343 DCHECK(ContainsKey(downloads_, download)); | 343 DCHECK(ContainsKey(downloads_, download)); |
| 344 DCHECK(ContainsKey(active_downloads_, download_id)); | 344 DCHECK(ContainsKey(active_downloads_, download_id)); |
| 345 | 345 |
| 346 // Make sure the initial file name is set only once. | 346 // Make sure the initial file name is set only once. |
| 347 DCHECK(download->full_path().empty()); | |
| 348 download->OnPathDetermined(chosen_file); | 347 download->OnPathDetermined(chosen_file); |
| 349 | 348 |
| 350 VLOG(20) << __FUNCTION__ << "()" | 349 VLOG(20) << __FUNCTION__ << "()" |
| 351 << " download = " << download->DebugString(true); | 350 << " download = " << download->DebugString(true); |
| 352 | 351 |
| 353 in_progress_[download_id] = download; | 352 in_progress_[download_id] = download; |
| 354 UpdateDownloadProgress(); // Reflect entry into in_progress_. | 353 UpdateDownloadProgress(); // Reflect entry into in_progress_. |
| 355 | 354 |
| 356 // Rename to intermediate name. | 355 // Rename to intermediate name. |
| 357 FilePath download_path; | 356 FilePath download_path; |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { | 1073 void DownloadManager::MarkDownloadOpened(DownloadItem* download) { |
| 1075 delegate_->UpdateItemInPersistentStore(download); | 1074 delegate_->UpdateItemInPersistentStore(download); |
| 1076 int num_unopened = 0; | 1075 int num_unopened = 0; |
| 1077 for (DownloadMap::iterator it = history_downloads_.begin(); | 1076 for (DownloadMap::iterator it = history_downloads_.begin(); |
| 1078 it != history_downloads_.end(); ++it) { | 1077 it != history_downloads_.end(); ++it) { |
| 1079 if (it->second->IsComplete() && !it->second->opened()) | 1078 if (it->second->IsComplete() && !it->second->opened()) |
| 1080 ++num_unopened; | 1079 ++num_unopened; |
| 1081 } | 1080 } |
| 1082 download_stats::RecordOpensOutstanding(num_unopened); | 1081 download_stats::RecordOpensOutstanding(num_unopened); |
| 1083 } | 1082 } |
| OLD | NEW |