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.content.ComponentName; | 7 import android.content.ComponentName; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.ServiceConnection; | 10 import android.content.ServiceConnection; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } else if (notificationInfo.type != DOWNLOAD_NOTIFICATION_TYPE_RESUME_AL
L) { | 264 } else if (notificationInfo.type != DOWNLOAD_NOTIFICATION_TYPE_RESUME_AL
L) { |
265 mActiveDownloads.remove(info.getDownloadGuid()); | 265 mActiveDownloads.remove(info.getDownloadGuid()); |
266 } | 266 } |
267 | 267 |
268 switch (notificationInfo.type) { | 268 switch (notificationInfo.type) { |
269 case DOWNLOAD_NOTIFICATION_TYPE_PROGRESS: | 269 case DOWNLOAD_NOTIFICATION_TYPE_PROGRESS: |
270 mBoundService.notifyDownloadProgress(info.getContentId(), info.g
etFileName(), | 270 mBoundService.notifyDownloadProgress(info.getContentId(), info.g
etFileName(), |
271 info.getPercentCompleted(), info.getBytesReceived(), | 271 info.getPercentCompleted(), info.getBytesReceived(), |
272 info.getTimeRemainingInMillis(), notificationInfo.startT
ime, | 272 info.getTimeRemainingInMillis(), notificationInfo.startT
ime, |
273 info.isOffTheRecord(), notificationInfo.canDownloadWhile
Metered, | 273 info.isOffTheRecord(), notificationInfo.canDownloadWhile
Metered, |
274 info.getIsTransient()); | 274 info.getIsTransient(), info.getIcon()); |
275 break; | 275 break; |
276 case DOWNLOAD_NOTIFICATION_TYPE_PAUSE: | 276 case DOWNLOAD_NOTIFICATION_TYPE_PAUSE: |
277 mBoundService.notifyDownloadPaused( | 277 mBoundService.notifyDownloadPaused( |
278 info.getContentId(), true, false, info.getIsTransient())
; | 278 info.getContentId(), true, false, info.getIsTransient(),
info.getIcon()); |
279 break; | 279 break; |
280 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT: | 280 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT: |
281 mBoundService.notifyDownloadPaused(info.getContentId(), info.isR
esumable(), | 281 mBoundService.notifyDownloadPaused(info.getContentId(), info.isR
esumable(), |
282 notificationInfo.isAutoResumable, info.getIsTransient())
; | 282 notificationInfo.isAutoResumable, info.getIsTransient(),
info.getIcon()); |
283 break; | 283 break; |
284 case DOWNLOAD_NOTIFICATION_TYPE_SUCCESS: | 284 case DOWNLOAD_NOTIFICATION_TYPE_SUCCESS: |
285 final int notificationId = mBoundService.notifyDownloadSuccessfu
l( | 285 final int notificationId = mBoundService.notifyDownloadSuccessfu
l( |
286 info.getContentId(), info.getFilePath(), info.getFileNam
e(), | 286 info.getContentId(), info.getFilePath(), info.getFileNam
e(), |
287 notificationInfo.systemDownloadId, info.isOffTheRecord()
, | 287 notificationInfo.systemDownloadId, info.isOffTheRecord()
, |
288 notificationInfo.isSupportedMimeType, info.getIsOpenable
()); | 288 notificationInfo.isSupportedMimeType, info.getIsOpenable
(), info.getIcon()); |
289 onSuccessNotificationShown(notificationInfo, notificationId); | 289 onSuccessNotificationShown(notificationInfo, notificationId); |
290 break; | 290 break; |
291 case DOWNLOAD_NOTIFICATION_TYPE_FAILURE: | 291 case DOWNLOAD_NOTIFICATION_TYPE_FAILURE: |
292 mBoundService.notifyDownloadFailed(info.getContentId(), info.get
FileName()); | 292 mBoundService.notifyDownloadFailed( |
| 293 info.getContentId(), info.getFileName(), info.getIcon())
; |
293 break; | 294 break; |
294 case DOWNLOAD_NOTIFICATION_TYPE_CANCEL: | 295 case DOWNLOAD_NOTIFICATION_TYPE_CANCEL: |
295 mBoundService.notifyDownloadCanceled(info.getContentId()); | 296 mBoundService.notifyDownloadCanceled(info.getContentId()); |
296 break; | 297 break; |
297 case DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL: | 298 case DOWNLOAD_NOTIFICATION_TYPE_RESUME_ALL: |
298 mBoundService.resumeAllPendingDownloads(); | 299 mBoundService.resumeAllPendingDownloads(); |
299 break; | 300 break; |
300 case DOWNLOAD_NOTIFICATION_TYPE_REMOVE_NOTIFICATION: | 301 case DOWNLOAD_NOTIFICATION_TYPE_REMOVE_NOTIFICATION: |
301 mBoundService.cancelNotification( | 302 mBoundService.cancelNotification( |
302 notificationInfo.notificationId, info.getContentId()); | 303 notificationInfo.notificationId, info.getContentId()); |
303 break; | 304 break; |
304 default: | 305 default: |
305 assert false; | 306 assert false; |
306 } | 307 } |
307 | 308 |
308 // Don't need to expose the notification id to ignore. Cancel will auto
matically call this | 309 // Don't need to expose the notification id to ignore. Cancel will auto
matically call this |
309 // method as well and pass it in. | 310 // method as well and pass it in. |
310 if (mBoundService != null) mBoundService.hideSummaryNotificationIfNecess
ary(-1); | 311 if (mBoundService != null) mBoundService.hideSummaryNotificationIfNecess
ary(-1); |
311 if (autoRelease) unbindServiceIfNeeded(); | 312 if (autoRelease) unbindServiceIfNeeded(); |
312 } | 313 } |
313 } | 314 } |
OLD | NEW |