Chromium Code Reviews| Index: chrome/browser/resources/hotword/constants.js |
| diff --git a/chrome/browser/resources/hotword/constants.js b/chrome/browser/resources/hotword/constants.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e8b86ef0ebac9afe65c3044ec40ab3b43a31a267 |
| --- /dev/null |
| +++ b/chrome/browser/resources/hotword/constants.js |
| @@ -0,0 +1,102 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +cr.define('hotword.constants', function() { |
| +'use strict'; |
| + |
| + |
| +/** |
| + * Hotword data shared module extension's id. |
|
James Hawkins
2014/08/13 14:13:16
s/id/ID/
Anand Mistry (off Chromium)
2014/08/15 04:27:00
Done.
|
| + * @const {string} |
| + * TODO(amistry): Replace with real shared module ID. |
| + */ |
| +var SHARED_MODULE_ID = 'bepbmhgboaologfdajaanbcjmnhjmhfn'; |
| + |
| + |
| +/** |
| + * Path to shared module data. |
| + * @const {string} |
| + */ |
| +var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID; |
|
rpetterson
2014/08/15 00:41:57
Is module a specific type of extension that we're
Anand Mistry (off Chromium)
2014/08/15 04:27:00
A "shared module" is a type of extension that prov
|
| + |
| + |
| +/** |
| + * Time to wait for expected messages, in milliseconds. |
| + * @enum {number} |
| + */ |
| +var Timeout = { |
|
James Hawkins
2014/08/13 14:13:16
The var name should have the unit of time in it.
Anand Mistry (off Chromium)
2014/08/15 04:27:00
Done.
|
| + SHORT: 200, |
| + NORMAL: 500, |
| + LONG: 2000 |
| +}; |
| + |
| + |
| +/** |
| + * The URL of the files used by the plugin. |
| + * @enum {string} |
| + */ |
| +var File = { |
| + RECOGNIZER_CONFIG: 'hotword.data', |
| +}; |
| + |
| + |
| +/** |
| + * Errors emitted by the NaClManager. |
| + * @enum {string} |
| + */ |
| +var Error = { |
| + NACL_CRASH: 'nacl_crash', |
| + TIMEOUT: 'timeout', |
| +}; |
| + |
| + |
| +/** |
| + * Event types supported by NaClManager. |
| + * @enum {string} |
| + */ |
| +var Event = { |
| + READY: 'ready', |
| + TRIGGER: 'trigger', |
| + ERROR: 'error', |
| +}; |
| + |
| + |
| +/** |
| + * Messages for communicating with the NaCl recognizer plugin. These must match |
| + * constants in <google3>/hotword_plugin.c |
| + * @enum {string} |
| + */ |
| +var NaClPlugin = { |
| + RESTART: 'r', |
| + SAMPLE_RATE_PREFIX: 'h', |
| + MODEL_PREFIX: 'm', |
| + STOP: 's', |
| + REQUEST_MODEL: 'model', |
| + MODEL_LOADED: 'model_loaded', |
| + READY_FOR_AUDIO: 'audio', |
| + STOPPED: 'stopped', |
| + HOTWORD_DETECTED: 'hotword', |
| + MS_CONFIGURED: 'ms_configured' |
| +}; |
| + |
| + |
| +/** |
| + * The browser UI language. |
| + * @const {string} |
| + */ |
| +var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ? |
| + chrome.i18n.getUILanguage() : ''; |
| + |
| +return { |
| + SHARED_MODULE_ID: SHARED_MODULE_ID, |
| + SHARED_MODULE_ROOT: SHARED_MODULE_ROOT, |
| + Timeout: Timeout, |
| + File: File, |
| + Error: Error, |
| + Event: Event, |
| + NaClPlugin: NaClPlugin, |
| + UI_LANGUAGE: UI_LANGUAGE |
| +}; |
| + |
| +}); |