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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 // TODO(rdsmith): Somewhat painful; make sure to disable in | 698 // TODO(rdsmith): Somewhat painful; make sure to disable in |
699 // release builds after resolution of http://crbug.com/85408. | 699 // release builds after resolution of http://crbug.com/85408. |
700 for (DownloadMap::iterator it = history_downloads_.begin(); | 700 for (DownloadMap::iterator it = history_downloads_.begin(); |
701 it != history_downloads_.end(); ++it) { | 701 it != history_downloads_.end(); ++it) { |
702 CHECK(it->second != download); | 702 CHECK(it->second != download); |
703 } | 703 } |
704 } | 704 } |
705 | 705 |
706 CHECK(ContainsKey(active_downloads_, download->id()) == | 706 CHECK(ContainsKey(active_downloads_, download->id()) == |
707 (download->state() == DownloadItem::IN_PROGRESS)); | 707 (download->state() == DownloadItem::IN_PROGRESS)); |
708 CHECK(ContainsKey(in_progress_, download->id()) == | |
709 (download->state() == DownloadItem::IN_PROGRESS)); | |
710 } | 708 } |
711 | 709 |
712 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) { | 710 bool DownloadManager::IsDownloadReadyForCompletion(DownloadItem* download) { |
713 // If we don't have all the data, the download is not ready for | 711 // If we don't have all the data, the download is not ready for |
714 // completion. | 712 // completion. |
715 if (!download->all_data_saved()) | 713 if (!download->all_data_saved()) |
716 return false; | 714 return false; |
717 | 715 |
718 // If the download is dangerous, but not yet validated, it's not ready for | 716 // If the download is dangerous, but not yet validated, it's not ready for |
719 // completion. | 717 // completion. |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 observed_download_manager_->RemoveObserver(this); | 1316 observed_download_manager_->RemoveObserver(this); |
1319 } | 1317 } |
1320 | 1318 |
1321 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { | 1319 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { |
1322 observing_download_manager_->NotifyModelChanged(); | 1320 observing_download_manager_->NotifyModelChanged(); |
1323 } | 1321 } |
1324 | 1322 |
1325 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1323 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
1326 observed_download_manager_ = NULL; | 1324 observed_download_manager_ = NULL; |
1327 } | 1325 } |
OLD | NEW |