Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2337)

Unified Diff: chrome/browser/resources/hotword/constants.js

Issue 464213002: Add a 'NaCl manager' to manage the state of the NaCl hotword detector plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
+};
+
+});

Powered by Google App Engine
This is Rietveld 408576698