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

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

Issue 2814603003: [Android O] Split out browser notification channels (Closed)
Patch Set: Fix up ChannelsUpdaterTest expectations 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 * Builds a summary notification that represents all downloads. 361 * Builds a summary notification that represents all downloads.
362 * {@see #buildSummaryNotification(Context)}. 362 * {@see #buildSummaryNotification(Context)}.
363 * @param context A context used to query Android strings and resources. 363 * @param context A context used to query Android strings and resources.
364 * @param iconId The id of an icon to use for the notification. 364 * @param iconId The id of an icon to use for the notification.
365 * @return a {@link Notification} that represents the summary icon fo r all downloads. 365 * @return a {@link Notification} that represents the summary icon fo r all downloads.
366 */ 366 */
367 private static Notification buildSummaryNotificationWithIcon(Context context , int iconId) { 367 private static Notification buildSummaryNotificationWithIcon(Context context , int iconId) {
368 ChromeNotificationBuilder builder = 368 ChromeNotificationBuilder builder =
369 NotificationBuilderFactory 369 NotificationBuilderFactory
370 .createChromeNotificationBuilder( 370 .createChromeNotificationBuilder(
371 true /* preferCompat */, ChannelsInitializer.CHA NNEL_ID_BROWSER) 371 true /* preferCompat */, ChannelsInitializer.CHA NNEL_ID_DOWNLOADS)
372 .setContentTitle( 372 .setContentTitle(
373 context.getString(R.string.download_notification _summary_title)) 373 context.getString(R.string.download_notification _summary_title))
374 .setSubText(context.getString(R.string.menu_downloads)) 374 .setSubText(context.getString(R.string.menu_downloads))
375 .setSmallIcon(iconId) 375 .setSmallIcon(iconId)
376 .setLocalOnly(true) 376 .setLocalOnly(true)
377 .setGroup(NotificationConstants.GROUP_DOWNLOADS) 377 .setGroup(NotificationConstants.GROUP_DOWNLOADS)
378 .setGroupSummary(true); 378 .setGroupSummary(true);
379 Bundle extras = new Bundle(); 379 Bundle extras = new Bundle();
380 extras.putInt(EXTRA_NOTIFICATION_BUNDLE_ICON_ID, iconId); 380 extras.putInt(EXTRA_NOTIFICATION_BUNDLE_ICON_ID, iconId);
381 builder.addExtras(extras); 381 builder.addExtras(extras);
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 * @return notification builder that builds the notification to be displayed 1072 * @return notification builder that builds the notification to be displayed
1073 */ 1073 */
1074 private ChromeNotificationBuilder buildNotification( 1074 private ChromeNotificationBuilder buildNotification(
1075 int iconId, String title, String contentText) { 1075 int iconId, String title, String contentText) {
1076 Bundle extras = new Bundle(); 1076 Bundle extras = new Bundle();
1077 extras.putInt(EXTRA_NOTIFICATION_BUNDLE_ICON_ID, iconId); 1077 extras.putInt(EXTRA_NOTIFICATION_BUNDLE_ICON_ID, iconId);
1078 1078
1079 ChromeNotificationBuilder builder = 1079 ChromeNotificationBuilder builder =
1080 NotificationBuilderFactory 1080 NotificationBuilderFactory
1081 .createChromeNotificationBuilder( 1081 .createChromeNotificationBuilder(
1082 true /* preferCompat */, ChannelsInitializer.CHA NNEL_ID_BROWSER) 1082 true /* preferCompat */, ChannelsInitializer.CHA NNEL_ID_DOWNLOADS)
1083 .setContentTitle( 1083 .setContentTitle(
1084 DownloadUtils.getAbbreviatedFileName(title, MAX_ FILE_NAME_LENGTH)) 1084 DownloadUtils.getAbbreviatedFileName(title, MAX_ FILE_NAME_LENGTH))
1085 .setSmallIcon(iconId) 1085 .setSmallIcon(iconId)
1086 .setLocalOnly(true) 1086 .setLocalOnly(true)
1087 .setAutoCancel(true) 1087 .setAutoCancel(true)
1088 .setContentText(contentText) 1088 .setContentText(contentText)
1089 .setGroup(NotificationConstants.GROUP_DOWNLOADS) 1089 .setGroup(NotificationConstants.GROUP_DOWNLOADS)
1090 .addExtras(extras); 1090 .addExtras(extras);
1091 return builder; 1091 return builder;
1092 } 1092 }
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return context.getString(R.string.remaining_duration_minutes, minute s); 1444 return context.getString(R.string.remaining_duration_minutes, minute s);
1445 } else if (minutes > 0) { 1445 } else if (minutes > 0) {
1446 return context.getString(R.string.remaining_duration_one_minute); 1446 return context.getString(R.string.remaining_duration_one_minute);
1447 } else if (seconds == 1) { 1447 } else if (seconds == 1) {
1448 return context.getString(R.string.remaining_duration_one_second); 1448 return context.getString(R.string.remaining_duration_one_second);
1449 } else { 1449 } else {
1450 return context.getString(R.string.remaining_duration_seconds, second s); 1450 return context.getString(R.string.remaining_duration_seconds, second s);
1451 } 1451 }
1452 } 1452 }
1453 } 1453 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698