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/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 if (result == DownloadProtectionService::DANGEROUS && | 343 if (result == DownloadProtectionService::DANGEROUS && |
344 item->GetSafetyState() == DownloadItem::SAFE) | 344 item->GetSafetyState() == DownloadItem::SAFE) |
345 item->MarkContentDangerous(); | 345 item->MarkContentDangerous(); |
346 | 346 |
347 SafeBrowsingStateMap::iterator it = safe_browsing_state_.find(item->GetId()); | 347 SafeBrowsingStateMap::iterator it = safe_browsing_state_.find(item->GetId()); |
348 DCHECK(it != safe_browsing_state_.end() && it->second.pending); | 348 DCHECK(it != safe_browsing_state_.end() && it->second.pending); |
349 if (it != safe_browsing_state_.end()) { | 349 if (it != safe_browsing_state_.end()) { |
350 it->second.pending = false; | 350 it->second.pending = false; |
351 it->second.verdict = result; | 351 it->second.verdict = result; |
352 } | 352 } |
353 download_manager_->MaybeCompleteDownload(item); | 353 item->MaybeCompleteDownload(); |
354 } | 354 } |
355 | 355 |
356 // content::NotificationObserver implementation. | 356 // content::NotificationObserver implementation. |
357 void ChromeDownloadManagerDelegate::Observe( | 357 void ChromeDownloadManagerDelegate::Observe( |
358 int type, | 358 int type, |
359 const content::NotificationSource& source, | 359 const content::NotificationSource& source, |
360 const content::NotificationDetails& details) { | 360 const content::NotificationDetails& details) { |
361 DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); | 361 DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); |
362 | 362 |
363 registrar_.Remove(this, | 363 registrar_.Remove(this, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 int32 download_id, int64 db_handle) { | 591 int32 download_id, int64 db_handle) { |
592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
593 // call this function with an invalid |db_handle|. For instance, this can | 593 // call this function with an invalid |db_handle|. For instance, this can |
594 // happen when the history database is offline. We cannot have multiple | 594 // happen when the history database is offline. We cannot have multiple |
595 // DownloadItems with the same invalid db_handle, so we need to assign a | 595 // DownloadItems with the same invalid db_handle, so we need to assign a |
596 // unique |db_handle| here. | 596 // unique |db_handle| here. |
597 if (db_handle == DownloadItem::kUninitializedHandle) | 597 if (db_handle == DownloadItem::kUninitializedHandle) |
598 db_handle = download_history_->GetNextFakeDbHandle(); | 598 db_handle = download_history_->GetNextFakeDbHandle(); |
599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
600 } | 600 } |
OLD | NEW |