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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 DownloadInfo info = notificationInfo.downloadInfo; | 261 DownloadInfo info = notificationInfo.downloadInfo; |
262 if (notificationInfo.type == DOWNLOAD_NOTIFICATION_TYPE_PROGRESS) { | 262 if (notificationInfo.type == DOWNLOAD_NOTIFICATION_TYPE_PROGRESS) { |
263 mActiveDownloads.add(info.getDownloadGuid()); | 263 mActiveDownloads.add(info.getDownloadGuid()); |
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.getProgress(), 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(), info.getIcon()); | 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(), info.getFileName(), true, false, in
fo.isOffTheRecord(), | 278 info.getContentId(), info.getFileName(), true, false, in
fo.isOffTheRecord(), |
279 info.getIsTransient(), info.getIcon()); | 279 info.getIsTransient(), info.getIcon()); |
280 break; | 280 break; |
281 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT: | 281 case DOWNLOAD_NOTIFICATION_TYPE_INTERRUPT: |
(...skipping 25 matching lines...) Expand all Loading... |
307 default: | 307 default: |
308 assert false; | 308 assert false; |
309 } | 309 } |
310 | 310 |
311 // Don't need to expose the notification id to ignore. Cancel will auto
matically call this | 311 // Don't need to expose the notification id to ignore. Cancel will auto
matically call this |
312 // method as well and pass it in. | 312 // method as well and pass it in. |
313 if (mBoundService != null) mBoundService.hideSummaryNotificationIfNecess
ary(-1); | 313 if (mBoundService != null) mBoundService.hideSummaryNotificationIfNecess
ary(-1); |
314 if (autoRelease) unbindServiceIfNeeded(); | 314 if (autoRelease) unbindServiceIfNeeded(); |
315 } | 315 } |
316 } | 316 } |
OLD | NEW |