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

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

Issue 2274573008: Open offline page instead of download home when clicking OPEN button on snackbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/DownloadNotificationService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
index b1eae15591a407831b1b75b2d5b63101cdef30bf..83bbc83c85b5503330af0f1eef055900f72b2212 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java
@@ -505,8 +505,9 @@ public class DownloadNotificationService extends Service {
: (intent.getAction() == ACTION_DOWNLOAD_OPEN
? DownloadSharedPreferenceEntry.ITEM_TYPE_OFFLINE_PAGE
: DownloadSharedPreferenceEntry.ITEM_TYPE_DOWNLOAD);
- DownloadServiceDelegate downloadServiceDelegate = getServiceDelegate(itemType);
- boolean destroyImmediately = true;
+ DownloadServiceDelegate downloadServiceDelegate =
+ intent.getAction() == ACTION_DOWNLOAD_OPEN ? null
+ : getServiceDelegate(itemType);
switch (intent.getAction()) {
case ACTION_DOWNLOAD_CANCEL:
// TODO(qinmin): Alternatively, we can delete the downloaded content on
@@ -532,25 +533,14 @@ public class DownloadNotificationService extends Service {
resumeAllPendingDownloads();
break;
case ACTION_DOWNLOAD_OPEN:
- final OfflinePageDownloadBridge bridge =
- (OfflinePageDownloadBridge) downloadServiceDelegate;
- destroyImmediately = false;
- bridge.addObserver(
- new OfflinePageDownloadBridge.Observer() {
- @Override
- public void onItemsLoaded() {
- String guid = IntentUtils.safeGetStringExtra(
- intent, EXTRA_DOWNLOAD_GUID);
- bridge.openItem(guid);
- bridge.destroyServiceDelegate();
- }
- });
+ OfflinePageDownloadBridge.openDownloadedPage(
+ IntentUtils.safeGetStringExtra(intent, EXTRA_DOWNLOAD_GUID));
break;
default:
Log.e(TAG, "Unrecognized intent action.", intent);
break;
}
- if (destroyImmediately) {
+ if (intent.getAction() != ACTION_DOWNLOAD_OPEN) {
downloadServiceDelegate.destroyServiceDelegate();
}
}

Powered by Google App Engine
This is Rietveld 408576698