| 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 |
| 299 #if defined(ENABLE_SAFE_BROWSING) | 312 #if defined(ENABLE_SAFE_BROWSING) |
| 300 DownloadProtectionService* | 313 DownloadProtectionService* |
| 301 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { | 314 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { |
| 302 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | 315 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); |
| 303 if (sb_service && sb_service->download_protection_service() && | 316 if (sb_service && sb_service->download_protection_service() && |
| 304 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { | 317 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { |
| 305 return sb_service->download_protection_service(); | 318 return sb_service->download_protection_service(); |
| 306 } | 319 } |
| 307 return NULL; | 320 return NULL; |
| 308 } | 321 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 int32 download_id, int64 db_handle) { | 604 int32 download_id, int64 db_handle) { |
| 592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 605 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
| 593 // call this function with an invalid |db_handle|. For instance, this can | 606 // call this function with an invalid |db_handle|. For instance, this can |
| 594 // happen when the history database is offline. We cannot have multiple | 607 // 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 | 608 // DownloadItems with the same invalid db_handle, so we need to assign a |
| 596 // unique |db_handle| here. | 609 // unique |db_handle| here. |
| 597 if (db_handle == DownloadItem::kUninitializedHandle) | 610 if (db_handle == DownloadItem::kUninitializedHandle) |
| 598 db_handle = download_history_->GetNextFakeDbHandle(); | 611 db_handle = download_history_->GetNextFakeDbHandle(); |
| 599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 612 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
| 600 } | 613 } |
| OLD | NEW |