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

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

Issue 2272883004: Fix the issue while clicking on offline page donwload notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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/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 7544e134e0e26ebbc6eaa5b817811820e69ef6ed..ce8b92ff88fe9a96f0107c14054b00a3c4400428 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
@@ -497,6 +497,7 @@ public class DownloadNotificationService extends Service {
? DownloadSharedPreferenceEntry.ITEM_TYPE_OFFLINE_PAGE
: DownloadSharedPreferenceEntry.ITEM_TYPE_DOWNLOAD);
DownloadServiceDelegate downloadServiceDelegate = getServiceDelegate(itemType);
+ boolean destroyImmediately = true;
switch (intent.getAction()) {
case ACTION_DOWNLOAD_CANCEL:
// TODO(qinmin): Alternatively, we can delete the downloaded content on
@@ -522,15 +523,27 @@ public class DownloadNotificationService extends Service {
resumeAllPendingDownloads();
break;
case ACTION_DOWNLOAD_OPEN:
- assert entry == null;
- String guid = IntentUtils.safeGetStringExtra(intent, EXTRA_DOWNLOAD_GUID);
- downloadServiceDelegate.openItem(guid);
+ 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();
+ }
+ });
break;
default:
Log.e(TAG, "Unrecognized intent action.", intent);
break;
}
- downloadServiceDelegate.destroyServiceDelegate();
+ if (destroyImmediately) {
+ downloadServiceDelegate.destroyServiceDelegate();
+ }
}
};
try {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698