| OLD | NEW |
| 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.BroadcastReceiver; | 8 import android.content.BroadcastReceiver; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.content.Intent; | 10 import android.content.Intent; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 break; | 38 break; |
| 39 } | 39 } |
| 40 } | 40 } |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Called to open a particular download item. Falls back to opening Downloa
d Home. | 43 * Called to open a particular download item. Falls back to opening Downloa
d Home. |
| 44 * @param context Context of the receiver. | 44 * @param context Context of the receiver. |
| 45 * @param intent Intent from the android DownloadManager. | 45 * @param intent Intent from the android DownloadManager. |
| 46 */ | 46 */ |
| 47 private void openDownload(final Context context, Intent intent) { | 47 private void openDownload(final Context context, Intent intent) { |
| 48 DownloadNotificationService.hideDanglingSummaryNotification(context); |
| 49 |
| 48 long ids[] = | 50 long ids[] = |
| 49 intent.getLongArrayExtra(DownloadManager.EXTRA_NOTIFICATION_CLIC
K_DOWNLOAD_IDS); | 51 intent.getLongArrayExtra(DownloadManager.EXTRA_NOTIFICATION_CLIC
K_DOWNLOAD_IDS); |
| 50 if (ids == null || ids.length == 0) { | 52 if (ids == null || ids.length == 0) { |
| 51 DownloadManagerService.openDownloadsPage(context); | 53 DownloadManagerService.openDownloadsPage(context); |
| 52 return; | 54 return; |
| 53 } | 55 } |
| 54 | 56 |
| 55 long id = ids[0]; | 57 long id = ids[0]; |
| 56 Uri uri = DownloadManagerDelegate.getContentUriFromDownloadManager(conte
xt, id); | 58 Uri uri = DownloadManagerDelegate.getContentUriFromDownloadManager(conte
xt, id); |
| 57 if (uri == null) { | 59 if (uri == null) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 72 * to start the browser process asynchronously, and resume or cancel the dow
nload afterwards. | 74 * to start the browser process asynchronously, and resume or cancel the dow
nload afterwards. |
| 73 * @param context Context of the receiver. | 75 * @param context Context of the receiver. |
| 74 * @param intent Intent retrieved from the notification. | 76 * @param intent Intent retrieved from the notification. |
| 75 */ | 77 */ |
| 76 private void performDownloadOperation(final Context context, Intent intent)
{ | 78 private void performDownloadOperation(final Context context, Intent intent)
{ |
| 77 if (DownloadNotificationService.isDownloadOperationIntent(intent)) { | 79 if (DownloadNotificationService.isDownloadOperationIntent(intent)) { |
| 78 DownloadNotificationService.startDownloadNotificationService(context
, intent); | 80 DownloadNotificationService.startDownloadNotificationService(context
, intent); |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 } | 83 } |
| OLD | NEW |