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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java

Issue 2258553003: [Downloads] Handle externally deleted items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dfalcantara@ review Created 4 years, 4 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
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
index 49bf8062b29b7bd3a4490441a4debbe0828d808c..5536fbad6192e537c9db6d2755667abce1d638e8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -1481,6 +1481,14 @@ public class DownloadManagerService extends BroadcastReceiver implements
nativeGetAllDownloads(getNativeDownloadManagerService(), isOffTheRecord);
}
+ /**
+ * Checks if the files associated with any downloads have been removed by an external action.
+ * @param isOffTheRecord Whether or not to check downloads for the off the record profile.
+ */
+ public void checkForExternallyRemovedDownloads(boolean isOffTheRecord) {
+ nativeCheckForExternallyRemovedDownloads(getNativeDownloadManagerService(), isOffTheRecord);
+ }
+
@CalledByNative
private List<DownloadItem> createDownloadItemList() {
return new ArrayList<DownloadItem>();
@@ -1488,9 +1496,11 @@ public class DownloadManagerService extends BroadcastReceiver implements
@CalledByNative
private void addDownloadItemToList(List<DownloadItem> list, String guid, String displayName,
- String filepath, String url, String mimeType, long startTimestamp, long totalBytes) {
+ String filepath, String url, String mimeType, long startTimestamp, long totalBytes,
+ boolean hasBeenExternallyRemoved) {
list.add(createDownloadItem(
- guid, displayName, filepath, url, mimeType, startTimestamp, totalBytes));
+ guid, displayName, filepath, url, mimeType, startTimestamp, totalBytes,
+ hasBeenExternallyRemoved));
}
@CalledByNative
@@ -1502,9 +1512,11 @@ public class DownloadManagerService extends BroadcastReceiver implements
@CalledByNative
private void onDownloadItemUpdated(String guid, String displayName, String filepath, String url,
- String mimeType, long startTimestamp, long totalBytes, boolean isOffTheRecord) {
+ String mimeType, long startTimestamp, long totalBytes, boolean isOffTheRecord,
+ boolean hasBeenExternallyRemoved) {
DownloadItem item = createDownloadItem(
- guid, displayName, filepath, url, mimeType, startTimestamp, totalBytes);
+ guid, displayName, filepath, url, mimeType, startTimestamp, totalBytes,
+ hasBeenExternallyRemoved);
for (DownloadHistoryAdapter adapter : mHistoryAdapters) {
adapter.onDownloadItemUpdated(item, isOffTheRecord);
}
@@ -1583,7 +1595,8 @@ public class DownloadManagerService extends BroadcastReceiver implements
public void purgeActiveNetworkList(long[] activeNetIds) {}
private static DownloadItem createDownloadItem(String guid, String displayName,
- String filepath, String url, String mimeType, long startTimestamp, long totalBytes) {
+ String filepath, String url, String mimeType, long startTimestamp, long totalBytes,
+ boolean hasBeenExternallyRemoved) {
DownloadInfo.Builder builder = new DownloadInfo.Builder()
.setDownloadGuid(guid)
.setFileName(displayName)
@@ -1593,6 +1606,7 @@ public class DownloadManagerService extends BroadcastReceiver implements
.setContentLength(totalBytes);
DownloadItem downloadItem = new DownloadItem(false, builder.build());
downloadItem.setStartTime(startTimestamp);
+ downloadItem.setHasBeenExternallyRemoved(hasBeenExternallyRemoved);
return downloadItem;
}
@@ -1608,4 +1622,6 @@ public class DownloadManagerService extends BroadcastReceiver implements
boolean isOffTheRecord);
private native void nativeGetAllDownloads(
long nativeDownloadManagerService, boolean isOffTheRecord);
+ private native void nativeCheckForExternallyRemovedDownloads(
+ long nativeDownloadManagerService, boolean isOffTheRecord);
}

Powered by Google App Engine
This is Rietveld 408576698