Commit b8dace20 authored by David Tseng's avatar David Tseng Committed by Commit Bot

Correct logic in ComponentLoader::AddChromeOsSpeechSynthesisExtensions

The logic here is incorrect.

All four states below are valid:
- Google tts exists, Espeak exists
- Google tts doesn't exist, Espeak exists
- Google tts exists, Espeak doesn't exist
- Google tts doesn't exist, Espeak doesn't exist

In cases where the extension doesn't exist, the expectation is that this function loads the extension. If neither extension exists, both should be loaded.

R=lazyboy@chromium.org

Bug: none
Test: manual. Observe that this function is called sometimes when one extension exists, and the other doesn't. Verify both are always loaded after this call.

Change-Id: Icd8138700876bd7414dce0d2b27fb672fb5d0846
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2343567Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Commit-Queue: David Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796109}
parent 92c9e271
...@@ -674,23 +674,25 @@ void ComponentLoader::AddWithNameAndDescriptionFromDir( ...@@ -674,23 +674,25 @@ void ComponentLoader::AddWithNameAndDescriptionFromDir(
} }
void ComponentLoader::AddChromeOsSpeechSynthesisExtensions() { void ComponentLoader::AddChromeOsSpeechSynthesisExtensions() {
if (Exists(extension_misc::kGoogleSpeechSynthesisExtensionId) || if (!Exists(extension_misc::kGoogleSpeechSynthesisExtensionId)) {
Exists(extension_misc::kEspeakSpeechSynthesisExtensionId)) AddComponentFromDir(
return; base::FilePath(extension_misc::kGoogleSpeechSynthesisExtensionPath),
extension_misc::kGoogleSpeechSynthesisExtensionId,
base::BindRepeating(
&ComponentLoader::FinishLoadSpeechSynthesisExtension,
weak_factory_.GetWeakPtr(),
extension_misc::kGoogleSpeechSynthesisExtensionId));
}
AddComponentFromDir( if (!Exists(extension_misc::kEspeakSpeechSynthesisExtensionId)) {
base::FilePath(extension_misc::kGoogleSpeechSynthesisExtensionPath), AddComponentFromDir(
extension_misc::kGoogleSpeechSynthesisExtensionId, base::FilePath(extension_misc::kEspeakSpeechSynthesisExtensionPath),
base::BindRepeating(&ComponentLoader::FinishLoadSpeechSynthesisExtension, extension_misc::kEspeakSpeechSynthesisExtensionId,
weak_factory_.GetWeakPtr(), base::BindRepeating(
extension_misc::kGoogleSpeechSynthesisExtensionId)); &ComponentLoader::FinishLoadSpeechSynthesisExtension,
weak_factory_.GetWeakPtr(),
AddComponentFromDir( extension_misc::kEspeakSpeechSynthesisExtensionId));
base::FilePath(extension_misc::kEspeakSpeechSynthesisExtensionPath), }
extension_misc::kEspeakSpeechSynthesisExtensionId,
base::BindRepeating(&ComponentLoader::FinishLoadSpeechSynthesisExtension,
weak_factory_.GetWeakPtr(),
extension_misc::kEspeakSpeechSynthesisExtensionId));
} }
void ComponentLoader::FinishAddComponentFromDir( void ComponentLoader::FinishAddComponentFromDir(
......
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