Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: chrome/browser/chromeos/drive/download_handler.cc

Issue 230133002: drive::DownloadHandler should query DownloadHistory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/download_handler.cc
diff --git a/chrome/browser/chromeos/drive/download_handler.cc b/chrome/browser/chromeos/drive/download_handler.cc
index b5ffb263f5848371f1f84e7e655ef0a153a68b59..f9032531549f1fca2cdec78b8c15309a8bdb58de 100644
--- a/chrome/browser/chromeos/drive/download_handler.cc
+++ b/chrome/browser/chromeos/drive/download_handler.cc
@@ -13,6 +13,9 @@
#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/write_on_cache_file.h"
+#include "chrome/browser/download/download_history.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
@@ -94,10 +97,15 @@ void ContinueCheckingForFileExistence(
// on the download history DB.
bool IsPersistedDriveDownload(const base::FilePath& drive_tmp_download_path,
DownloadItem* download) {
- // Persisted downloads are not in IN_PROGRESS state when created, while newly
- // created downloads are.
- return drive_tmp_download_path.IsParent(download->GetTargetFilePath()) &&
- download->GetState() != DownloadItem::IN_PROGRESS;
+ if (!drive_tmp_download_path.IsParent(download->GetTargetFilePath()))
+ return false;
+
+ DownloadService* download_service =
+ DownloadServiceFactory::GetForBrowserContext(
+ download->GetBrowserContext());
+ DownloadHistory* download_history = download_service->GetDownloadHistory();
+
+ return download_history && download_history->WasRestoredFromHistory(download);
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698