| 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 "chrome/browser/download/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 // TODO(rdsmith): Somewhat painful; make sure to disable in | 721 // TODO(rdsmith): Somewhat painful; make sure to disable in |
| 722 // release builds after resolution of http://crbug.com/85408. | 722 // release builds after resolution of http://crbug.com/85408. |
| 723 for (DownloadMap::iterator it = history_downloads_.begin(); | 723 for (DownloadMap::iterator it = history_downloads_.begin(); |
| 724 it != history_downloads_.end(); ++it) { | 724 it != history_downloads_.end(); ++it) { |
| 725 CHECK(it->second != download); | 725 CHECK(it->second != download); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 | 728 |
| 729 CHECK(ContainsKey(active_downloads_, download->id()) == | 729 CHECK(ContainsKey(active_downloads_, download->id()) == |
| 730 (download->state() == DownloadItem::IN_PROGRESS)); | 730 (download->state() == DownloadItem::IN_PROGRESS)); |
| 731 CHECK(ContainsKey(in_progress_, download->id()) == | |
| 732 (download->state() == DownloadItem::IN_PROGRESS)); | |
| 733 } | 731 } |
| 734 | 732 |
| 735 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) { | 733 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) { |
| 736 // If we don't have all the data, the download is not ready for | 734 // If we don't have all the data, the download is not ready for |
| 737 // completion. | 735 // completion. |
| 738 if (!download->all_data_saved()) | 736 if (!download->all_data_saved()) |
| 739 return false; | 737 return false; |
| 740 | 738 |
| 741 // If the download is dangerous, but not yet validated, it's not ready for | 739 // If the download is dangerous, but not yet validated, it's not ready for |
| 742 // completion. | 740 // completion. |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 observed_download_manager_->RemoveObserver(this); | 1354 observed_download_manager_->RemoveObserver(this); |
| 1357 } | 1355 } |
| 1358 | 1356 |
| 1359 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { | 1357 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { |
| 1360 observing_download_manager_->NotifyModelChanged(); | 1358 observing_download_manager_->NotifyModelChanged(); |
| 1361 } | 1359 } |
| 1362 | 1360 |
| 1363 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1361 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
| 1364 observed_download_manager_ = NULL; | 1362 observed_download_manager_ = NULL; |
| 1365 } | 1363 } |
| OLD | NEW |