Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService.java

Issue 2772343003: Android: Remove GetApplicationContext part 1 (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.annotation.TargetApi; 7 import android.annotation.TargetApi;
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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 * Gets appropriate download delegate that can handle interactions with down load item referred 1197 * Gets appropriate download delegate that can handle interactions with down load item referred
1198 * to by the entry. 1198 * to by the entry.
1199 * @param id The {@link ContentId} to grab the delegate for. 1199 * @param id The {@link ContentId} to grab the delegate for.
1200 * @return delegate for interactions with the entry 1200 * @return delegate for interactions with the entry
1201 */ 1201 */
1202 DownloadServiceDelegate getServiceDelegate(ContentId id) { 1202 DownloadServiceDelegate getServiceDelegate(ContentId id) {
1203 if (LegacyHelpers.isLegacyOfflinePage(id)) { 1203 if (LegacyHelpers.isLegacyOfflinePage(id)) {
1204 return OfflinePageDownloadBridge.getDownloadServiceDelegate(); 1204 return OfflinePageDownloadBridge.getDownloadServiceDelegate();
1205 } 1205 }
1206 if (LegacyHelpers.isLegacyDownload(id)) { 1206 if (LegacyHelpers.isLegacyDownload(id)) {
1207 return DownloadManagerService.getDownloadManagerService(getApplicati onContext()); 1207 return DownloadManagerService.getDownloadManagerService();
1208 } 1208 }
1209 1209
1210 Log.e(TAG, "Unrecognized download type.", id); 1210 Log.e(TAG, "Unrecognized download type.", id);
1211 // Return the DownloadManagerService if we can't detect the type. 1211 // Return the DownloadManagerService if we can't detect the type.
1212 return DownloadManagerService.getDownloadManagerService(getApplicationCo ntext()); 1212 return DownloadManagerService.getDownloadManagerService();
1213 } 1213 }
1214 1214
1215 @VisibleForTesting 1215 @VisibleForTesting
1216 void updateNotification(int id, Notification notification) { 1216 void updateNotification(int id, Notification notification) {
1217 mNotificationManager.notify(NOTIFICATION_NAMESPACE, id, notification); 1217 mNotificationManager.notify(NOTIFICATION_NAMESPACE, id, notification);
1218 } 1218 }
1219 1219
1220 private void updateNotification(int notificationId, Notification notificatio n, ContentId id, 1220 private void updateNotification(int notificationId, Notification notificatio n, ContentId id,
1221 DownloadSharedPreferenceEntry entry) { 1221 DownloadSharedPreferenceEntry entry) {
1222 updateNotification(notificationId, notification); 1222 updateNotification(notificationId, notification);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 return context.getString(R.string.remaining_duration_minutes, minute s); 1368 return context.getString(R.string.remaining_duration_minutes, minute s);
1369 } else if (minutes > 0) { 1369 } else if (minutes > 0) {
1370 return context.getString(R.string.remaining_duration_one_minute); 1370 return context.getString(R.string.remaining_duration_one_minute);
1371 } else if (seconds == 1) { 1371 } else if (seconds == 1) {
1372 return context.getString(R.string.remaining_duration_one_second); 1372 return context.getString(R.string.remaining_duration_one_second);
1373 } else { 1373 } else {
1374 return context.getString(R.string.remaining_duration_seconds, second s); 1374 return context.getString(R.string.remaining_duration_seconds, second s);
1375 } 1375 }
1376 } 1376 }
1377 } 1377 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698