Commit 5e903374 authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Add Espeak component extension support behind a flag

See bug for more context; the Espeak extension provides
a lower-quality speech engine that supports many more
languages, enabling us to support virtually all world
languages out-of-the-box on Chrome OS without requiring
a separate download.

This new engine must be in a separate component
extension due to having a different license.

This patch puts the extension load behind a flag,
--enable-experimental-accessibility-features, because
it needs some more polish before we launch it to
all users.

Bug: 862710
TBR=michaelpg@chromium.org

Change-Id: Ia4d010fa5ff217928a3a66d17543bd4990d24c10
Reviewed-on: https://chromium-review.googlesource.com/c/1247038
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601852}
parent a5ce12d9
...@@ -31,8 +31,9 @@ bool IsComponentExtensionWhitelisted(const std::string& extension_id) { ...@@ -31,8 +31,9 @@ bool IsComponentExtensionWhitelisted(const std::string& extension_id) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
extension_misc::kAssessmentAssistantExtensionId, extension_misc::kAssessmentAssistantExtensionId,
extension_misc::kChromeVoxExtensionId, extension_misc::kChromeVoxExtensionId,
extension_misc::kEspeakSpeechSynthesisExtensionId,
extension_misc::kGoogleSpeechSynthesisExtensionId,
extension_misc::kSelectToSpeakExtensionId, extension_misc::kSelectToSpeakExtensionId,
extension_misc::kSpeechSynthesisExtensionId,
extension_misc::kSwitchAccessExtensionId, extension_misc::kSwitchAccessExtensionId,
extension_misc::kZipArchiverExtensionId, extension_misc::kZipArchiverExtensionId,
#endif #endif
......
...@@ -351,13 +351,20 @@ void ComponentLoader::AddNetworkSpeechSynthesisExtension() { ...@@ -351,13 +351,20 @@ void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
} }
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void ComponentLoader::AddChromeOsSpeechSynthesisExtension() { void ComponentLoader::AddChromeOsSpeechSynthesisExtensions() {
AddComponentFromDir( AddComponentFromDir(
base::FilePath(extension_misc::kSpeechSynthesisExtensionPath), base::FilePath(extension_misc::kGoogleSpeechSynthesisExtensionPath),
extension_misc::kSpeechSynthesisExtensionId, extension_misc::kGoogleSpeechSynthesisExtensionId,
base::Bind(&ComponentLoader::EnableFileSystemInGuestMode, base::BindRepeating(&ComponentLoader::EnableFileSystemInGuestMode,
weak_factory_.GetWeakPtr(), weak_factory_.GetWeakPtr(),
extension_misc::kSpeechSynthesisExtensionId)); extension_misc::kGoogleSpeechSynthesisExtensionId));
if (chromeos::switches::AreExperimentalAccessibilityFeaturesEnabled()) {
AddComponentFromDir(
base::FilePath(extension_misc::kEspeakSpeechSynthesisExtensionPath),
extension_misc::kEspeakSpeechSynthesisExtensionId,
base::RepeatingClosure());
}
} }
#endif #endif
......
...@@ -110,7 +110,7 @@ class ComponentLoader { ...@@ -110,7 +110,7 @@ class ComponentLoader {
const std::string& name_string, const std::string& name_string,
const std::string& description_string); const std::string& description_string);
void AddChromeOsSpeechSynthesisExtension(); void AddChromeOsSpeechSynthesisExtensions();
#endif #endif
void set_ignore_whitelist_for_testing(bool value) { void set_ignore_whitelist_for_testing(bool value) {
......
...@@ -321,17 +321,17 @@ bool TtsExtensionEngine::LoadBuiltInTtsExtension( ...@@ -321,17 +321,17 @@ bool TtsExtensionEngine::LoadBuiltInTtsExtension(
content::BrowserContext* browser_context) { content::BrowserContext* browser_context) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
Profile* profile = Profile::FromBrowserContext(browser_context); Profile* profile = Profile::FromBrowserContext(browser_context);
// Check to see if the engine was previously loaded. // Check to see if one of the engines was previously loaded.
if (TtsEngineExtensionObserver::GetInstance(profile)->SawExtensionLoad( if (TtsEngineExtensionObserver::GetInstance(profile)->SawExtensionLoad(
extension_misc::kSpeechSynthesisExtensionId, true)) { extension_misc::kGoogleSpeechSynthesisExtensionId, true)) {
return false; return false;
} }
// Load the component extension into this profile. // Load the component extensions into this profile.
extensions::ExtensionService* extension_service = extensions::ExtensionService* extension_service =
extensions::ExtensionSystem::Get(profile)->extension_service(); extensions::ExtensionSystem::Get(profile)->extension_service();
DCHECK(extension_service); DCHECK(extension_service);
extension_service->component_loader()->AddChromeOsSpeechSynthesisExtension(); extension_service->component_loader()->AddChromeOsSpeechSynthesisExtensions();
return true; return true;
#else #else
return false; return false;
......
...@@ -176,7 +176,7 @@ void TtsHandler::WakeTtsEngine(const base::ListValue* args) { ...@@ -176,7 +176,7 @@ void TtsHandler::WakeTtsEngine(const base::ListValue* args) {
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
TtsExtensionEngine::GetInstance()->LoadBuiltInTtsExtension(profile); TtsExtensionEngine::GetInstance()->LoadBuiltInTtsExtension(profile);
extensions::ProcessManager::Get(profile)->WakeEventPage( extensions::ProcessManager::Get(profile)->WakeEventPage(
extension_misc::kSpeechSynthesisExtensionId, extension_misc::kGoogleSpeechSynthesisExtensionId,
base::BindOnce(&TtsHandler::OnTtsEngineAwake, base::BindOnce(&TtsHandler::OnTtsEngineAwake,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
} }
......
...@@ -59,9 +59,13 @@ const char kConnectivityDiagnosticsPath[] = ...@@ -59,9 +59,13 @@ const char kConnectivityDiagnosticsPath[] =
const char kConnectivityDiagnosticsLauncherPath[] = const char kConnectivityDiagnosticsLauncherPath[] =
"/usr/share/chromeos-assets/connectivity_diagnostics_launcher"; "/usr/share/chromeos-assets/connectivity_diagnostics_launcher";
const char kFirstRunDialogId[] = "jdgcneonijmofocbhmijhacgchbihela"; const char kFirstRunDialogId[] = "jdgcneonijmofocbhmijhacgchbihela";
const char kSpeechSynthesisExtensionPath[] = const char kEspeakSpeechSynthesisExtensionPath[] =
"/usr/share/chromeos-assets/speech_synthesis/espeak-ng";
const char kEspeakSpeechSynthesisExtensionId[] =
"dakbfdmgjiabojdgbiljlhgjbokobjpg";
const char kGoogleSpeechSynthesisExtensionPath[] =
"/usr/share/chromeos-assets/speech_synthesis/patts"; "/usr/share/chromeos-assets/speech_synthesis/patts";
const char kSpeechSynthesisExtensionId[] = const char kGoogleSpeechSynthesisExtensionId[] =
"gjjabgpgjpampikjhjpfhneeoapjbjaf"; "gjjabgpgjpampikjhjpfhneeoapjbjaf";
const char kWallpaperManagerId[] = "obklkkbkpaoaejdabbfldmcfplpdgolj"; const char kWallpaperManagerId[] = "obklkkbkpaoaejdabbfldmcfplpdgolj";
const char kZipArchiverExtensionId[] = "dmboannefpncccogfdikhmhpmdnddgoe"; const char kZipArchiverExtensionId[] = "dmboannefpncccogfdikhmhpmdnddgoe";
......
...@@ -215,10 +215,14 @@ extern const char kConnectivityDiagnosticsPath[]; ...@@ -215,10 +215,14 @@ extern const char kConnectivityDiagnosticsPath[];
extern const char kConnectivityDiagnosticsLauncherPath[]; extern const char kConnectivityDiagnosticsLauncherPath[];
// The extension id of the first run dialog application. // The extension id of the first run dialog application.
extern const char kFirstRunDialogId[]; extern const char kFirstRunDialogId[];
// Path to preinstalled speech synthesis extension. // Path to preinstalled Google speech synthesis extension.
extern const char kSpeechSynthesisExtensionPath[]; extern const char kGoogleSpeechSynthesisExtensionPath[];
// The extension id of the speech synthesis extension. // The extension id of the Google speech synthesis extension.
extern const char kSpeechSynthesisExtensionId[]; extern const char kGoogleSpeechSynthesisExtensionId[];
// Path to preinstalled eSpeak-NG speech synthesis extension.
extern const char kEspeakSpeechSynthesisExtensionPath[];
// The extension id of the eSpeak-NG speech synthesis extension.
extern const char kEspeakSpeechSynthesisExtensionId[];
// The extension id of the wallpaper manager application. // The extension id of the wallpaper manager application.
extern const char kWallpaperManagerId[]; extern const char kWallpaperManagerId[];
// The extension id of the zip archiver extension. // The extension id of the zip archiver extension.
......
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