OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('hotword.constants', function() { |
| 6 'use strict'; |
| 7 |
| 8 |
| 9 /** |
| 10 * Hotword data shared module extension's ID. |
| 11 * @const {string} |
| 12 * TODO(amistry): Replace with real shared module ID. |
| 13 */ |
| 14 var SHARED_MODULE_ID = 'bepbmhgboaologfdajaanbcjmnhjmhfn'; |
| 15 |
| 16 |
| 17 /** |
| 18 * Path to shared module data. |
| 19 * @const {string} |
| 20 */ |
| 21 var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID; |
| 22 |
| 23 |
| 24 /** |
| 25 * Time to wait for expected messages, in milliseconds. |
| 26 * @enum {number} |
| 27 */ |
| 28 var TimeoutMs = { |
| 29 SHORT: 200, |
| 30 NORMAL: 500, |
| 31 LONG: 2000 |
| 32 }; |
| 33 |
| 34 |
| 35 /** |
| 36 * The URL of the files used by the plugin. |
| 37 * @enum {string} |
| 38 */ |
| 39 var File = { |
| 40 RECOGNIZER_CONFIG: 'hotword.data', |
| 41 }; |
| 42 |
| 43 |
| 44 /** |
| 45 * Errors emitted by the NaClManager. |
| 46 * @enum {string} |
| 47 */ |
| 48 var Error = { |
| 49 NACL_CRASH: 'nacl_crash', |
| 50 TIMEOUT: 'timeout', |
| 51 }; |
| 52 |
| 53 |
| 54 /** |
| 55 * Event types supported by NaClManager. |
| 56 * @enum {string} |
| 57 */ |
| 58 var Event = { |
| 59 READY: 'ready', |
| 60 TRIGGER: 'trigger', |
| 61 ERROR: 'error', |
| 62 }; |
| 63 |
| 64 |
| 65 /** |
| 66 * Messages for communicating with the NaCl recognizer plugin. These must match |
| 67 * constants in <google3>/hotword_plugin.c |
| 68 * @enum {string} |
| 69 */ |
| 70 var NaClPlugin = { |
| 71 RESTART: 'r', |
| 72 SAMPLE_RATE_PREFIX: 'h', |
| 73 MODEL_PREFIX: 'm', |
| 74 STOP: 's', |
| 75 REQUEST_MODEL: 'model', |
| 76 MODEL_LOADED: 'model_loaded', |
| 77 READY_FOR_AUDIO: 'audio', |
| 78 STOPPED: 'stopped', |
| 79 HOTWORD_DETECTED: 'hotword', |
| 80 MS_CONFIGURED: 'ms_configured' |
| 81 }; |
| 82 |
| 83 |
| 84 /** |
| 85 * The browser UI language. |
| 86 * @const {string} |
| 87 */ |
| 88 var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ? |
| 89 chrome.i18n.getUILanguage() : ''; |
| 90 |
| 91 return { |
| 92 SHARED_MODULE_ID: SHARED_MODULE_ID, |
| 93 SHARED_MODULE_ROOT: SHARED_MODULE_ROOT, |
| 94 TimeoutMs: TimeoutMs, |
| 95 File: File, |
| 96 Error: Error, |
| 97 Event: Event, |
| 98 NaClPlugin: NaClPlugin, |
| 99 UI_LANGUAGE: UI_LANGUAGE |
| 100 }; |
| 101 |
| 102 }); |
OLD | NEW |