Commit 075d1694 authored by amistry's avatar amistry Committed by Commit bot

Replace placeholder extension ID for hotwording shared module with ID of...

Replace placeholder extension ID for hotwording shared module with ID of module uploaded to the Chrome web store.

Also, auto-install hotword shared module when hotwording is enabled.

BUG=397019

Review URL: https://codereview.chromium.org/599053004

Cr-Commit-Position: refs/heads/master@{#296890}
parent 84eeb930
......@@ -50,12 +50,11 @@ void ExternalComponentLoader::StartLoading() {
if (HotwordServiceFactory::IsHotwordAllowed(profile_)) {
std::string hotwordId = extension_misc::kHotwordExtensionId;
CommandLine* command_line = CommandLine::ForCurrentProcess();
// TODO(amistry): Load the hotword shared module when enabling built-in
// hotword detection.
if (!command_line->HasSwitch(switches::kEnableExperimentalHotwording)) {
prefs_->SetString(hotwordId + ".external_update_url",
extension_urls::GetWebstoreUpdateUrl().spec());
if (command_line->HasSwitch(switches::kEnableExperimentalHotwording)) {
hotwordId = extension_misc::kHotwordSharedModuleId;
}
prefs_->SetString(hotwordId + ".external_update_url",
extension_urls::GetWebstoreUpdateUrl().spec());
}
InitBookmarksExperimentState(profile_);
......
......@@ -8,9 +8,8 @@ cr.define('hotword.constants', function() {
/**
* Hotword data shared module extension's ID.
* @const {string}
* TODO(amistry): Replace with real shared module ID.
*/
var SHARED_MODULE_ID = 'bepbmhgboaologfdajaanbcjmnhjmhfn';
var SHARED_MODULE_ID = 'lccekmodgklaepjeofjdjpbminllajkg';
/**
* Path to shared module data.
......
......@@ -38,10 +38,7 @@
"import": [
{
// TODO(amistry): For now, use a locally modified version of the external
// hotword extension. Replace with the ID of the new shared module
// containing the hotword detector.
"id": "bepbmhgboaologfdajaanbcjmnhjmhfn"
"id": "lccekmodgklaepjeofjdjpbminllajkg"
}
],
......
......@@ -384,8 +384,16 @@ bool HotwordService::IsServiceAvailable() {
ExtensionService* service = system->extension_service();
// Include disabled extensions (true parameter) since it may not be enabled
// if the user opted out.
std::string extensionId;
if (IsExperimentalHotwordingEnabled()) {
// TODO(amistry): Handle reloading on language change as the old extension
// does.
extensionId = extension_misc::kHotwordSharedModuleId;
} else {
extensionId = extension_misc::kHotwordExtensionId;
}
const extensions::Extension* extension =
service->GetExtensionById(extension_misc::kHotwordExtensionId, true);
service->GetExtensionById(extensionId, true);
if (!extension)
error_message_ = IDS_HOTWORD_GENERIC_ERROR_MESSAGE;
......
......@@ -45,6 +45,7 @@ const char kCroshBuiltinAppId[] = "nkoccljplnhpfnfiajclkommnmllphnl";
const char kHotwordAudioVerificationAppId[] =
"abjokfonkihficiokmkfboogholifghn";
const char kHotwordExtensionId[] = "bepbmhgboaologfdajaanbcjmnhjmhfn";
const char kHotwordSharedModuleId[] = "lccekmodgklaepjeofjdjpbminllajkg";
const char kPdfExtensionId[] = "mhjfbmdgcfjbbpaeojofohoefgiehjai";
const char kQuickOfficeComponentExtensionId[] =
"bpmcpldpdmajfigpchkicefoigmkfalc";
......
......@@ -79,6 +79,9 @@ extern const char kHotwordAudioVerificationAppId[];
// The extension id of the hotword voice search trigger extension.
extern const char kHotwordExtensionId[];
// The extension id of the hotword shared module.
extern const char kHotwordSharedModuleId[];
// The extension id of the PDF extension.
extern const char kPdfExtensionId[];
......
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