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