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 e339403e39051e9337abc2ae7336ddd45cb8bfe2..65e7318f8c326bc8dd494d035471f3a4130f83dc 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 |
@@ -1065,13 +1065,11 @@ public class DownloadManagerService extends BroadcastReceiver implements |
? false : ExternalNavigationDelegateImpl.resolveIntent(intent, true); |
} |
- /** See {@link #openDownloadedContent(Context, String, boolean, long)}. */ |
+ /** See {@link #openDownloadedContent(Context, String, boolean, boolean, String, long)}. */ |
protected void openDownloadedContent(final DownloadInfo downloadInfo, final long downloadId) { |
- // TODO(shaktisahu): Move this to the broader openDownloadedContent() or a better place if |
- // possible. |
- updateLastAccessTime(downloadInfo.getDownloadGuid(), downloadInfo.isOffTheRecord()); |
openDownloadedContent(mContext, downloadInfo.getFilePath(), |
- isSupportedMimeType(downloadInfo.getMimeType()), downloadId); |
+ isSupportedMimeType(downloadInfo.getMimeType()), downloadInfo.isOffTheRecord(), |
+ downloadInfo.getDownloadGuid(), downloadId); |
} |
/** |
@@ -1081,10 +1079,13 @@ public class DownloadManagerService extends BroadcastReceiver implements |
* @param context Context to use. |
* @param filePath Path to the downloaded item. |
* @param isSupportedMimeType MIME type of the downloaded item. |
+ * @param isOffTheRecord Whether the download was for a off the record profile. |
+ * @param downloadGuid GUID of the download item in DownloadManager. |
* @param downloadId ID of the download item in DownloadManager. |
*/ |
protected static void openDownloadedContent(final Context context, final String filePath, |
- final boolean isSupportedMimeType, final long downloadId) { |
+ final boolean isSupportedMimeType, final boolean isOffTheRecord, |
+ final String downloadGuid, final long downloadId) { |
new AsyncTask<Void, Void, Intent>() { |
@Override |
public Intent doInBackground(Void... params) { |
@@ -1098,6 +1099,10 @@ public class DownloadManagerService extends BroadcastReceiver implements |
|| !ExternalNavigationDelegateImpl.resolveIntent(intent, true) |
|| !DownloadUtils.fireOpenIntentForDownload(context, intent)) { |
openDownloadsPage(context); |
+ } else { |
+ DownloadManagerService service = |
+ DownloadManagerService.getDownloadManagerService(context); |
+ service.updateLastAccessTime(downloadGuid, isOffTheRecord); |
} |
} |
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); |