| 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.ActivityManager; | 7 import android.app.ActivityManager; |
| 8 import android.app.DownloadManager; | 8 import android.app.DownloadManager; |
| 9 import android.app.Notification; | 9 import android.app.Notification; |
| 10 import android.app.NotificationManager; | 10 import android.app.NotificationManager; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 * @param downloadGuid GUID of the download. | 328 * @param downloadGuid GUID of the download. |
| 329 * @param fileName GUID of the download. | 329 * @param fileName GUID of the download. |
| 330 * @param systemDownloadId Download ID assigned by system DownloadManager. | 330 * @param systemDownloadId Download ID assigned by system DownloadManager. |
| 331 * @return ID of the successful download notification. Used for removing the
notification when | 331 * @return ID of the successful download notification. Used for removing the
notification when |
| 332 * user click on the snackbar. | 332 * user click on the snackbar. |
| 333 */ | 333 */ |
| 334 public int notifyDownloadSuccessful( | 334 public int notifyDownloadSuccessful( |
| 335 String downloadGuid, String fileName, long systemDownloadId, boolean
isOfflinePage) { | 335 String downloadGuid, String fileName, long systemDownloadId, boolean
isOfflinePage) { |
| 336 int notificationId = getNotificationId(downloadGuid); | 336 int notificationId = getNotificationId(downloadGuid); |
| 337 NotificationCompat.Builder builder = buildNotification( | 337 NotificationCompat.Builder builder = buildNotification( |
| 338 android.R.drawable.stat_sys_download_done, fileName, | 338 R.drawable.offline_pin, fileName, |
| 339 mContext.getResources().getString(R.string.download_notification
_completed)); | 339 mContext.getResources().getString(R.string.download_notification
_completed)); |
| 340 ComponentName component = new ComponentName( | 340 ComponentName component = new ComponentName( |
| 341 mContext.getPackageName(), DownloadBroadcastReceiver.class.getNa
me()); | 341 mContext.getPackageName(), DownloadBroadcastReceiver.class.getNa
me()); |
| 342 Intent intent; | 342 Intent intent; |
| 343 if (isOfflinePage) { | 343 if (isOfflinePage) { |
| 344 intent = buildActionIntent(ACTION_DOWNLOAD_OPEN, notificationId, dow
nloadGuid, fileName, | 344 intent = buildActionIntent(ACTION_DOWNLOAD_OPEN, notificationId, dow
nloadGuid, fileName, |
| 345 isOfflinePage); | 345 isOfflinePage); |
| 346 } else { | 346 } else { |
| 347 intent = new Intent(DownloadManager.ACTION_NOTIFICATION_CLICKED); | 347 intent = new Intent(DownloadManager.ACTION_NOTIFICATION_CLICKED); |
| 348 long[] idArray = {systemDownloadId}; | 348 long[] idArray = {systemDownloadId}; |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 return context.getString(R.string.remaining_duration_minutes, minute
s); | 789 return context.getString(R.string.remaining_duration_minutes, minute
s); |
| 790 } else if (minutes > 0) { | 790 } else if (minutes > 0) { |
| 791 return context.getString(R.string.remaining_duration_one_minute); | 791 return context.getString(R.string.remaining_duration_one_minute); |
| 792 } else if (seconds == 1) { | 792 } else if (seconds == 1) { |
| 793 return context.getString(R.string.remaining_duration_one_second); | 793 return context.getString(R.string.remaining_duration_one_second); |
| 794 } else { | 794 } else { |
| 795 return context.getString(R.string.remaining_duration_seconds, second
s); | 795 return context.getString(R.string.remaining_duration_seconds, second
s); |
| 796 } | 796 } |
| 797 } | 797 } |
| 798 } | 798 } |
| OLD | NEW |