Commit 5084f39c authored by Abigail Klein's avatar Abigail Klein Committed by Commit Bot

[Live Caption] Update messaging around speech model being downloaded.

Based on UXW feedback, modify the live caption settings subtitle string
and add a new download complete string. Also, only show the download
error message when there is an error event from the component updater.
Previously, we also showed an error message if the download progress
was unknown, but it is better to do nothing in that case and wait for
more information about the download progress.

Bug: 1055150
Change-Id: Ib8343b45b20b8a3b66a4dbbc15361189d015cae7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343231Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Abigail Klein <abigailbklein@google.com>
Cr-Commit-Position: refs/heads/master@{#796076}
parent 38b2e1b6
......@@ -57,11 +57,14 @@
Get captions for your media
</message>
<message name="IDS_SETTINGS_CAPTIONS_ENABLE_LIVE_CAPTION_SUBTITLE" desc="Subtitle of the setting to enable Live Caption.">
Chrome automatically creates English captions using Live Caption
Chrome automatically creates captions using Live Caption (currently available in English only)
</message>
<message name="IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_PROGRESS" desc="This message is displayed as a subtitle to the Live Caption title while the model is being downloading. It shows the download progress as a percentage and is updated dynamically.">
Downloading speech recognition files... <ph name="PERCENT">$1<ex>17</ex></ph>%
</message>
<message name="IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_COMPLETE" desc="Message displayed when the live caption files have completed downloading.">
Speech recognition files downloaded
</message>
<message name="IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_ERROR" desc="Message displayed when there is an error downloading the live caption files.">
The required files can't be downloaded. Try again later.
</message>
......
1b43a1c226fe097dfcd7e3a9d9e95c02dc6545a7
\ No newline at end of file
b27e796150aefe4b797d705ae882cd27b52c1171
\ No newline at end of file
edd696d0dbddbda2d581b1f9f5f9ae1b3251744b
\ No newline at end of file
......@@ -138,9 +138,9 @@ void AccessibilityMainHandler::OnEvent(Events event, const std::string& id) {
g_browser_process->component_updater()->GetComponentDetails(id, &item);
const int progress =
GetDownloadProgress(item.downloaded_bytes, item.total_bytes);
if (progress == -1) {
SendLiveCaptionDownloadError();
} else {
// When GetDownloadProgress returns -1, do nothing. It returns -1 when the
// downloaded or total bytes is unknown.
if (progress != -1) {
FireWebUIListener(
"enable-live-caption-subtitle-changed",
base::Value(l10n_util::GetStringFUTF16Int(
......@@ -153,23 +153,20 @@ void AccessibilityMainHandler::OnEvent(Events event, const std::string& id) {
FireWebUIListener(
"enable-live-caption-subtitle-changed",
base::Value(l10n_util::GetStringUTF16(
IDS_SETTINGS_CAPTIONS_ENABLE_LIVE_CAPTION_SUBTITLE)));
IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_COMPLETE)));
break;
case Events::COMPONENT_UPDATE_ERROR:
SendLiveCaptionDownloadError();
prefs_->SetBoolean(prefs::kLiveCaptionEnabled, false);
FireWebUIListener(
"enable-live-caption-subtitle-changed",
base::Value(l10n_util::GetStringUTF16(
IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_ERROR)));
break;
case Events::COMPONENT_CHECKING_FOR_UPDATES:
// Do nothing.
break;
}
}
void AccessibilityMainHandler::SendLiveCaptionDownloadError() {
prefs_->SetBoolean(prefs::kLiveCaptionEnabled, false);
FireWebUIListener("enable-live-caption-subtitle-changed",
base::Value(l10n_util::GetStringUTF16(
IDS_SETTINGS_CAPTIONS_LIVE_CAPTION_DOWNLOAD_ERROR)));
}
#endif // defined(OS_CHROMEOS)
} // namespace settings
......@@ -64,8 +64,6 @@ class AccessibilityMainHandler : public ::settings::SettingsPageUIHandler,
// component_updater::ServiceObserver:
void OnEvent(Events event, const std::string& id) override;
void SendLiveCaptionDownloadError();
PrefService* prefs_;
ScopedObserver<component_updater::ComponentUpdateService,
component_updater::ComponentUpdateService::Observer>
......
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