Commit dabf5058 authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Move download related strings from chrome to components so they can be shared by WebLayer.

Bug: 1025603
Change-Id: I10ae4609d00c1ad2c23c04226e2ac930149fe1cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136086
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Auto-Submit: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756462}
parent 15ab8559
......@@ -2266,21 +2266,9 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
</message>
<!-- Download UI -->
<message name="IDS_DOWNLOAD_NOTIFICATION_CANCEL_BUTTON" desc="Text on the button that cancels a download.">
Cancel
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_COMPLETED" desc="Download notification to be displayed when a download completes.">
Download complete
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_COMPLETED_WITH_SIZE" desc="Download notification to be displayed when a download completes, includes the size of the download as well after a separator character.">
Download complete <ph name="SEPARATOR"></ph> <ph name="BYTES_DOWNLOADED">%1$s<ex>4.3 MB</ex></ph>
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_FAILED" desc="Download notification to be displayed when a download fails.">
Download failed
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_PAUSED" desc="Download notification to be displayed when a download pauses.">
Download paused
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_PENDING" desc="Download notification to be displayed when a download has been scheduled but has not started being fetched from the network.">
Download pending…
</message>
......@@ -2296,12 +2284,6 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
<message name="IDS_DOWNLOAD_CANT_OPEN_FILE" desc="Toast that appears when a downloaded file can't be opened.">
Can’t open file
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_PAUSE_BUTTON" desc="Text on the button that pauses a download.">
Pause
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_RESUME_BUTTON" desc="Text on the button that resumes a paused download.">
Resume
</message>
<message name="IDS_DOWNLOAD_FAILED_REASON_FILE_ALREADY_EXISTS" desc="Message to explain that the download failed because file already exists.">
<ph name="FILE_NAME">%1$s<ex>http://abc.com/test.pdf</ex></ph> download prevented because file already exists.
</message>
......@@ -2326,21 +2308,6 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
<message name="IDS_DOWNLOAD_STARTED" desc="Message to show when download has started [CHAR LIMIT=30]">
Downloading…
</message>
<message name="IDS_DOWNLOAD_UI_KB" desc="String indicating the size of a downloaded file (in progress or complete), in kilobytes.">
<ph name="kilobytes">%1$3.2f<ex>12.5</ex></ph> KB
</message>
<message name="IDS_DOWNLOAD_UI_MB" desc="String indicating the size of a downloaded file (in progress or complete), in megabytes.">
<ph name="megabytes">%1$3.2f<ex>12.5</ex></ph> MB
</message>
<message name="IDS_DOWNLOAD_UI_GB" desc="String indicating the size of a downloaded file (in progress or complete), in gigabytes.">
<ph name="gigabytes">%1$3.2f<ex>12.5</ex></ph> GB
</message>
<message name="IDS_DOWNLOAD_UI_INDETERMINATE_BYTES" desc="Appears in a notification when a user starts downloading a file. Indicates the number of bytes downloaded out of an unknown total file size. E.g. 3/? MB [downloaded]. As appropriate for your language, use '/' or 'of'; and change word order as needed.">
<ph name="BYTES_DOWNLOADED_WITH_UNITS">%1$s<ex>12.2 MB</ex></ph> / ?
</message>
<message name="IDS_DOWNLOAD_UI_DETERMINATE_BYTES" desc="Appears in a notification when a user starts downloading a file. Indicates the number of bytes downloaded out of the total file size. E.g. 3/7 MB [downloaded]. As appropriate for your language, use '/' or 'of'; and change word order as needed.">
<ph name="BYTES_DOWNLOADED_WITH_UNITS">%1$s<ex>12.2 MB</ex></ph> / <ph name="FILE_SIZE_WITH_UNITS">%2$s<ex>20.3 GB</ex></ph>
</message>
<message name="IDS_FILE_SIZE_DOWNLOADED_KB" desc="Notification message showing how many KBs have been downloaded.">
Downloaded <ph name="KBS">%1$.1f<ex>10.1</ex></ph> KB
</message>
......
......@@ -369,6 +369,41 @@
<message name="IDS_ACCESSIBILITY_COLLAPSED_GROUP" desc="The accessibility text to read when the selected widget is collapsed.">
Collapsed - click to expand.
</message>
<!-- Downloads UI -->
<message name="IDS_DOWNLOAD_NOTIFICATION_CANCEL_BUTTON" desc="Text on the button that cancels a download.">
Cancel
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_COMPLETED_WITH_SIZE" desc="Download notification to be displayed when a download completes, includes the size of the download as well after a separator character.">
Download complete <ph name="SEPARATOR"></ph> <ph name="BYTES_DOWNLOADED">%1$s<ex>4.3 MB</ex></ph>
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_FAILED" desc="Download notification to be displayed when a download fails.">
Download failed
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_PAUSED" desc="Download notification to be displayed when a download pauses.">
Download paused
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_PAUSE_BUTTON" desc="Text on the button that pauses a download.">
Pause
</message>
<message name="IDS_DOWNLOAD_NOTIFICATION_RESUME_BUTTON" desc="Text on the button that resumes a paused download.">
Resume
</message>
<message name="IDS_DOWNLOAD_UI_DETERMINATE_BYTES" desc="Appears in a notification when a user starts downloading a file. Indicates the number of bytes downloaded out of the total file size. E.g. 3/7 MB [downloaded]. As appropriate for your language, use '/' or 'of'; and change word order as needed.">
<ph name="BYTES_DOWNLOADED_WITH_UNITS">%1$s<ex>12.2 MB</ex></ph> / <ph name="FILE_SIZE_WITH_UNITS">%2$s<ex>20.3 GB</ex></ph>
</message>
<message name="IDS_DOWNLOAD_UI_INDETERMINATE_BYTES" desc="Appears in a notification when a user starts downloading a file. Indicates the number of bytes downloaded out of an unknown total file size. E.g. 3/? MB [downloaded]. As appropriate for your language, use '/' or 'of'; and change word order as needed.">
<ph name="BYTES_DOWNLOADED_WITH_UNITS">%1$s<ex>12.2 MB</ex></ph> / ?
</message>
<message name="IDS_DOWNLOAD_UI_KB" desc="String indicating the size of a downloaded file (in progress or complete), in kilobytes.">
<ph name="kilobytes">%1$3.2f<ex>12.5</ex></ph> KB
</message>
<message name="IDS_DOWNLOAD_UI_MB" desc="String indicating the size of a downloaded file (in progress or complete), in megabytes.">
<ph name="megabytes">%1$3.2f<ex>12.5</ex></ph> MB
</message>
<message name="IDS_DOWNLOAD_UI_GB" desc="String indicating the size of a downloaded file (in progress or complete), in gigabytes.">
<ph name="gigabytes">%1$3.2f<ex>12.5</ex></ph> GB
</message>
</messages>
</release>
</grit>
......@@ -11,6 +11,7 @@ import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.RemoteException;
import android.text.TextUtils;
......@@ -401,6 +402,9 @@ public final class DownloadImpl extends IDownload.Stub {
mBuilder.mActions.clear();
Context context = ContextUtils.getApplicationContext();
Resources resources = context.getResources();
if (state == DownloadState.COMPLETE) {
Intent openIntent = createIntent();
openIntent.setAction(OPEN_INTENT);
......@@ -408,8 +412,8 @@ public final class DownloadImpl extends IDownload.Stub {
openIntent.putExtra(EXTRA_NOTIFICATION_PROFILE, mProfileName);
openIntent.putExtra(EXTRA_NOTIFICATION_LOCATION, getLocation());
openIntent.putExtra(EXTRA_NOTIFICATION_MIME_TYPE, getMimeType());
PendingIntent openPendingIntent = PendingIntent.getBroadcast(
ContextUtils.getApplicationContext(), mNotificationId, openIntent, 0);
PendingIntent openPendingIntent =
PendingIntent.getBroadcast(context, mNotificationId, openIntent, 0);
mBuilder.setProgress(100, 100, false)
.setOngoing(false)
......@@ -417,8 +421,7 @@ public final class DownloadImpl extends IDownload.Stub {
.setContentIntent(openPendingIntent)
.setAutoCancel(true);
} else if (state == DownloadState.FAILED) {
// TODO(jam): make these strings translated
mBuilder.setContentText("Download failed")
mBuilder.setContentText(resources.getString(R.string.download_notification_failed))
.setOngoing(false)
.setSmallIcon(android.R.drawable.stat_sys_download_done);
} else if (state == DownloadState.IN_PROGRESS) {
......@@ -426,18 +429,22 @@ public final class DownloadImpl extends IDownload.Stub {
pauseIntent.setAction(PAUSE_INTENT);
pauseIntent.putExtra(EXTRA_NOTIFICATION_ID, mNotificationId);
pauseIntent.putExtra(EXTRA_NOTIFICATION_PROFILE, mProfileName);
PendingIntent pausePendingIntent = PendingIntent.getBroadcast(
ContextUtils.getApplicationContext(), mNotificationId, pauseIntent, 0);
mBuilder.addAction(0 /* no icon */, "Pause", pausePendingIntent)
PendingIntent pausePendingIntent =
PendingIntent.getBroadcast(context, mNotificationId, pauseIntent, 0);
mBuilder.addAction(0 /* no icon */,
resources.getString(R.string.download_notification_pause_button),
pausePendingIntent)
.setSmallIcon(android.R.drawable.stat_sys_download);
} else if (state == DownloadState.PAUSED) {
Intent resumeIntent = createIntent();
resumeIntent.setAction(RESUME_INTENT);
resumeIntent.putExtra(EXTRA_NOTIFICATION_ID, mNotificationId);
resumeIntent.putExtra(EXTRA_NOTIFICATION_PROFILE, mProfileName);
PendingIntent resumePendingIntent = PendingIntent.getBroadcast(
ContextUtils.getApplicationContext(), mNotificationId, resumeIntent, 0);
mBuilder.addAction(0 /* no icon */, "Resume", resumePendingIntent)
PendingIntent resumePendingIntent =
PendingIntent.getBroadcast(context, mNotificationId, resumeIntent, 0);
mBuilder.addAction(0 /* no icon */,
resources.getString(R.string.download_notification_resume_button),
resumePendingIntent)
.setSmallIcon(android.R.drawable.ic_media_pause);
}
......@@ -446,9 +453,11 @@ public final class DownloadImpl extends IDownload.Stub {
cancelIntent.setAction(CANCEL_INTENT);
cancelIntent.putExtra(EXTRA_NOTIFICATION_ID, mNotificationId);
cancelIntent.putExtra(EXTRA_NOTIFICATION_PROFILE, mProfileName);
PendingIntent cancelPendingIntent = PendingIntent.getBroadcast(
ContextUtils.getApplicationContext(), mNotificationId, cancelIntent, 0);
mBuilder.addAction(0 /* no icon */, "Cancel", cancelPendingIntent);
PendingIntent cancelPendingIntent =
PendingIntent.getBroadcast(context, mNotificationId, cancelIntent, 0);
mBuilder.addAction(0 /* no icon */,
resources.getString(R.string.download_notification_cancel_button),
cancelPendingIntent);
}
if (notificationManager != null) {
......
......@@ -57,6 +57,17 @@ IDS_CLOCK_ERROR_EXPLANATION
IDS_CLOCK_ERROR_PRIMARY_PARAGRAPH
IDS_CLOCK_ERROR_TITLE
IDS_CLOCK_ERROR_UPDATE_DATE_AND_TIME
IDS_DOWNLOAD_NOTIFICATION_CANCEL_BUTTON
IDS_DOWNLOAD_NOTIFICATION_COMPLETED_WITH_SIZE
IDS_DOWNLOAD_NOTIFICATION_FAILED
IDS_DOWNLOAD_NOTIFICATION_PAUSED
IDS_DOWNLOAD_NOTIFICATION_PAUSE_BUTTON
IDS_DOWNLOAD_NOTIFICATION_RESUME_BUTTON
IDS_DOWNLOAD_UI_DETERMINATE_BYTES
IDS_DOWNLOAD_UI_INDETERMINATE_BYTES
IDS_DOWNLOAD_UI_KB
IDS_DOWNLOAD_UI_MB
IDS_DOWNLOAD_UI_GB
IDS_FLASH_PERMISSION_FRAGMENT
IDS_FLASH_PERMISSION_WARNING_FRAGMENT
IDS_GEOLOCATION_INFOBAR_PERMISSION_FRAGMENT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment