Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| index 6e48c1ea6647b4b84b8b2b22517b6e97aef8da09..ec087eabc9914e65432027da6a073c84c3b82ee5 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java |
| @@ -467,12 +467,13 @@ public class DownloadUtils { |
| * Opens a file in Chrome or in another app if appropriate. |
| * @param file path to the file to open. |
| * @param mimeType mime type of the file. |
| + * @param downloadGuid The associated download GUID. |
| * @param isOffTheRecord whether we are in an off the record context. |
| * @return whether the file could successfully be opened. |
| */ |
| - public static boolean openFile(File file, String mimeType, boolean isOffTheRecord) { |
| + public static boolean openFile( |
| + File file, String mimeType, String downloadGuid, boolean isOffTheRecord) { |
| Context context = ContextUtils.getApplicationContext(); |
| - Intent viewIntent = createViewIntentForDownloadItem(getUriForItem(file), mimeType); |
| DownloadManagerService service = DownloadManagerService.getDownloadManagerService(context); |
| // Check if Chrome should open the file itself. |
| @@ -486,11 +487,13 @@ public class DownloadUtils { |
| Intent intent = |
| getMediaViewerIntentForDownloadItem(fileUri, contentUri, normalizedMimeType); |
| IntentHandler.startActivityForTrustedIntent(intent); |
| + service.updateLastAccessTime(downloadGuid, isOffTheRecord); |
| return true; |
| } |
| // Check if any apps can open the file. |
| try { |
| + Intent viewIntent = createViewIntentForDownloadItem(getUriForItem(file), mimeType); |
|
vitaliii
2017/03/10 08:15:46
Why not to update last access time before "return
shaktisahu
2017/03/10 08:46:55
Actually, it presents a choice of apps to the user
vitaliii
2017/03/10 09:04:38
I see. However, the user has clicked on the item t
shaktisahu
2017/03/10 15:23:01
Ok. I will add that, although technically this is
vitaliii
2017/03/10 16:41:21
I think that this approach is better. Otherwise, y
|
| context.startActivity(viewIntent); |
| return true; |
| } catch (ActivityNotFoundException e) { |