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

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

Issue 2376893006: [Downloads] Open media downloads internally (Closed)
Patch Set: Test changes, moving files Created 4 years, 2 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 | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java
index 126209fc7295a1011a6d2f2f13fc9619d4d0d289..160a61b5027f84c03dd7573a9f64e098a9b27083 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastReceiver.java
@@ -5,13 +5,14 @@
package org.chromium.chrome.browser.download;
import android.app.DownloadManager;
-import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
+import org.chromium.chrome.browser.util.IntentUtils;
+
/**
* This {@link BroadcastReceiver} handles clicks to download notifications and their action buttons.
* Clicking on an in-progress or failed download will open the download manager. Clicking on
@@ -58,12 +59,11 @@ public class DownloadBroadcastReceiver extends BroadcastReceiver {
// Open the downloads page
DownloadManagerService.openDownloadsPage(context);
} else {
- Intent launchIntent = new Intent(Intent.ACTION_VIEW);
- launchIntent.setDataAndType(uri, manager.getMimeTypeForDownloadedFile(id));
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- try {
- context.startActivity(launchIntent);
- } catch (ActivityNotFoundException e) {
+ String downloadFilename = IntentUtils.safeGetStringExtra(
+ intent, DownloadNotificationService.EXTRA_DOWNLOAD_FILE_PATH);
+ Intent launchIntent = DownloadManagerService.getLaunchIntentFromDownloadId(
+ context, downloadFilename, id);
+ if (!DownloadUtils.fireOpenIntentForDownload(context, launchIntent)) {
DownloadManagerService.openDownloadsPage(context);
}
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698