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

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

Issue 2588933002: [Downloads] Address offline pages notification (Closed)
Patch Set: Sanity chek Created 4 years 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 23f08c89848d3cc425870051a79528b1570ac82b..b3f30eff3317d7747059840819b01b714f952129 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
@@ -592,8 +592,12 @@ public class DownloadNotificationService extends Service {
* @param intent Intent with the download operation.
*/
private void handleDownloadOperation(final Intent intent) {
+ // TODO(qinmin): Figure out how to properly handle this case.
+ boolean isOfflinePage =
+ IntentUtils.safeGetBooleanExtra(intent, EXTRA_IS_OFFLINE_PAGE, false);
final DownloadSharedPreferenceEntry entry = getDownloadEntryFromIntent(intent);
- if (entry == null) {
+ if (entry == null
+ && !(isOfflinePage && TextUtils.equals(intent.getAction(), ACTION_DOWNLOAD_OPEN))) {
handleDownloadOperationForMissingNotification(intent);
return;
}
@@ -690,9 +694,12 @@ public class DownloadNotificationService extends Service {
* This can happen because the DownloadNotificationService learn about downloads later than
* Download Home does, and may not yet have a DownloadSharedPreferenceEntry for the item.
*
- * TODO(qinmin): Talk with dfalcantara@ about whether this is the best path forward.
+ * TODO(qinmin): Figure out how to fix the SharedPreferences so that it properly tracks entries.
*/
private void handleDownloadOperationForMissingNotification(Intent intent) {
+ // This function should only be called via Download Home, but catch this case to be safe.
+ if (!DownloadManagerService.hasDownloadManagerService()) return;
+
String action = intent.getAction();
String downloadGuid = IntentUtils.safeGetStringExtra(intent, EXTRA_DOWNLOAD_GUID);
boolean isOffTheRecord =
« 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