| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 const FilePath& suggested_path, | 289 const FilePath& suggested_path, |
| 290 const FilePath::StringType& default_extension, | 290 const FilePath::StringType& default_extension, |
| 291 bool can_save_as_complete, | 291 bool can_save_as_complete, |
| 292 content::SaveFilePathPickedCallback callback) { | 292 content::SaveFilePathPickedCallback callback) { |
| 293 // Deletes itself. | 293 // Deletes itself. |
| 294 new SavePackageFilePicker( | 294 new SavePackageFilePicker( |
| 295 web_contents, suggested_path, default_extension, can_save_as_complete, | 295 web_contents, suggested_path, default_extension, can_save_as_complete, |
| 296 download_prefs_.get(), callback); | 296 download_prefs_.get(), callback); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ChromeDownloadManagerDelegate::DownloadProgressUpdated() { | |
| 300 if (!g_browser_process->download_status_updater()) | |
| 301 return; | |
| 302 | |
| 303 float progress = 0; | |
| 304 int download_count = 0; | |
| 305 bool progress_known = | |
| 306 g_browser_process->download_status_updater()->GetProgress( | |
| 307 &progress, &download_count); | |
| 308 download_util::UpdateAppIconDownloadProgress( | |
| 309 download_count, progress_known, progress); | |
| 310 } | |
| 311 | |
| 312 #if defined(ENABLE_SAFE_BROWSING) | 299 #if defined(ENABLE_SAFE_BROWSING) |
| 313 DownloadProtectionService* | 300 DownloadProtectionService* |
| 314 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { | 301 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { |
| 315 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 302 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); |
| 316 if (sb_service && sb_service->download_protection_service() && | 303 if (sb_service && sb_service->download_protection_service() && |
| 317 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { | 304 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { |
| 318 return sb_service->download_protection_service(); | 305 return sb_service->download_protection_service(); |
| 319 } | 306 } |
| 320 return NULL; | 307 return NULL; |
| 321 } | 308 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 int32 download_id, int64 db_handle) { | 591 int32 download_id, int64 db_handle) { |
| 605 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
| 606 // 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 |
| 607 // happen when the history database is offline. We cannot have multiple | 594 // happen when the history database is offline. We cannot have multiple |
| 608 // 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 |
| 609 // unique |db_handle| here. | 596 // unique |db_handle| here. |
| 610 if (db_handle == DownloadItem::kUninitializedHandle) | 597 if (db_handle == DownloadItem::kUninitializedHandle) |
| 611 db_handle = download_history_->GetNextFakeDbHandle(); | 598 db_handle = download_history_->GetNextFakeDbHandle(); |
| 612 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
| 613 } | 600 } |
| OLD | NEW |