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

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

Issue 2239133002: [Offline pages] Downloads UI: Adding bridge for issuing notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@download-notifications
Patch Set: Minimizing the patch to handle direct WC capture on download button 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import android.app.DownloadManager; 7 import android.app.DownloadManager;
8 import android.content.ActivityNotFoundException; 8 import android.content.ActivityNotFoundException;
9 import android.content.BroadcastReceiver; 9 import android.content.BroadcastReceiver;
10 import android.content.ComponentName; 10 import android.content.ComponentName;
(...skipping 12 matching lines...) Expand all
23 @Override 23 @Override
24 public void onReceive(final Context context, Intent intent) { 24 public void onReceive(final Context context, Intent intent) {
25 String action = intent.getAction(); 25 String action = intent.getAction();
26 switch (action) { 26 switch (action) {
27 case DownloadManager.ACTION_NOTIFICATION_CLICKED: 27 case DownloadManager.ACTION_NOTIFICATION_CLICKED:
28 openDownload(context, intent); 28 openDownload(context, intent);
29 break; 29 break;
30 case DownloadNotificationService.ACTION_DOWNLOAD_RESUME: 30 case DownloadNotificationService.ACTION_DOWNLOAD_RESUME:
31 case DownloadNotificationService.ACTION_DOWNLOAD_CANCEL: 31 case DownloadNotificationService.ACTION_DOWNLOAD_CANCEL:
32 case DownloadNotificationService.ACTION_DOWNLOAD_PAUSE: 32 case DownloadNotificationService.ACTION_DOWNLOAD_PAUSE:
33 case DownloadNotificationService.ACTION_DOWNLOAD_OPEN:
33 performDownloadOperation(context, intent); 34 performDownloadOperation(context, intent);
34 break; 35 break;
35 default: 36 default:
36 break; 37 break;
37 } 38 }
38 } 39 }
39 40
40 /** 41 /**
41 * Called to open a given download item that is downloaded by the android Do wnloadManager. 42 * Called to open a given download item that is downloaded by the android Do wnloadManager.
42 * @param context Context of the receiver. 43 * @param context Context of the receiver.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 * @param intent Intent retrieved from the notification. 76 * @param intent Intent retrieved from the notification.
76 */ 77 */
77 private void performDownloadOperation(final Context context, Intent intent) { 78 private void performDownloadOperation(final Context context, Intent intent) {
78 if (DownloadNotificationService.isDownloadOperationIntent(intent)) { 79 if (DownloadNotificationService.isDownloadOperationIntent(intent)) {
79 Intent launchIntent = new Intent(intent); 80 Intent launchIntent = new Intent(intent);
80 launchIntent.setComponent(new ComponentName( 81 launchIntent.setComponent(new ComponentName(
81 context.getPackageName(), DownloadNotificationService.class. getName())); 82 context.getPackageName(), DownloadNotificationService.class. getName()));
82 context.startService(launchIntent); 83 context.startService(launchIntent);
83 } 84 }
84 } 85 }
85 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698