Commit 7c24fc13 authored by evliu's avatar evliu Committed by Chromium LUCI CQ

Register SODA language pack component only if the Live caption feature is enabled

This CL adds a check to only register the SODA language pack component if the LiveCaption and UseSodaForLiveCaption features are enabled as well as the Live caption toggle switch.

Bug: 1156412
Change-Id: Icede8bd752c6617ca16a0f55da926cd8ab0b1675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590625Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Evan Liu <evliu@google.com>
Cr-Commit-Position: refs/heads/master@{#836870}
parent 22116927
......@@ -222,25 +222,28 @@ void RegisterSodaLanguageComponent(ComponentUpdateService* cus,
PrefService* global_prefs) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (base::FeatureList::IsEnabled(media::kUseSodaForLiveCaption)) {
speech::LanguageCode language = speech::GetLanguageCode(
profile_prefs->GetString(prefs::kLiveCaptionLanguageCode));
switch (language) {
case speech::LanguageCode::kNone:
// Do nothing.
break;
case speech::LanguageCode::kEnUs:
RegisterSodaEnUsComponent(
cus, global_prefs,
base::BindOnce(&SodaEnUsComponentInstallerPolicy::
UpdateSodaEnUsComponentOnDemand));
break;
case speech::LanguageCode::kJaJp:
RegisterSodaJaJpComponent(
cus, global_prefs,
base::BindOnce(&SodaJaJpComponentInstallerPolicy::
UpdateSodaJaJpComponentOnDemand));
break;
if (base::FeatureList::IsEnabled(media::kUseSodaForLiveCaption) &&
base::FeatureList::IsEnabled(media::kLiveCaption)) {
if (profile_prefs->GetBoolean(prefs::kLiveCaptionEnabled)) {
speech::LanguageCode language = speech::GetLanguageCode(
profile_prefs->GetString(prefs::kLiveCaptionLanguageCode));
switch (language) {
case speech::LanguageCode::kNone:
// Do nothing.
break;
case speech::LanguageCode::kEnUs:
RegisterSodaEnUsComponent(
cus, global_prefs,
base::BindOnce(&SodaEnUsComponentInstallerPolicy::
UpdateSodaEnUsComponentOnDemand));
break;
case speech::LanguageCode::kJaJp:
RegisterSodaJaJpComponent(
cus, global_prefs,
base::BindOnce(&SodaJaJpComponentInstallerPolicy::
UpdateSodaJaJpComponentOnDemand));
break;
}
}
}
}
......
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