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

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

Issue 600523004: Support hotwording on google.com and the new tab page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More review comments. Created 6 years, 2 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
« no previous file with comments | « chrome/browser/resources/hotword/audio_client.js ('k') | chrome/browser/resources/hotword/manager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/hotword/constants.js
diff --git a/chrome/browser/resources/hotword/constants.js b/chrome/browser/resources/hotword/constants.js
index 8b0b43d9ec7966443cdc111dbf16f1c26f7aab79..97dedb34a97e4f18884dd36d9ef3c705d4f421d1 100644
--- a/chrome/browser/resources/hotword/constants.js
+++ b/chrome/browser/resources/hotword/constants.js
@@ -18,6 +18,18 @@ var SHARED_MODULE_ID = 'lccekmodgklaepjeofjdjpbminllajkg';
var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID;
/**
+ * Name used by the content scripts to create communications Ports.
+ * @const {string}
+ */
+var CLIENT_PORT_NAME = 'chwcpn';
+
+/**
+ * The field name to specify the command among pages.
+ * @const {string}
+ */
+var COMMAND_FIELD_NAME = 'cmd';
+
+/**
* Time to wait for expected messages, in milliseconds.
* @enum {number}
*/
@@ -73,11 +85,42 @@ var NaClPlugin = {
};
/**
+ * Messages sent from the injected scripts to the Google page.
+ * @enum {string}
+ */
+var CommandToPage = {
+ HOTWORD_VOICE_TRIGGER: 'vt',
+ HOTWORD_STARTED: 'hs',
+ HOTWORD_ENDED: 'hd',
+ HOTWORD_TIMEOUT: 'ht',
+ HOTWORD_ERROR: 'he'
+};
+
+/**
+ * Messages sent from the Google page to the injected scripts
+ * and then passed to the extension.
+ * @enum {string}
+ */
+var CommandFromPage = {
+ SPEECH_START: 'ss',
+ SPEECH_END: 'se',
+ SPEECH_RESET: 'sr',
+ SHOWING_HOTWORD_START: 'shs',
+ SHOWING_ERROR_MESSAGE: 'sem',
+ SHOWING_TIMEOUT_MESSAGE: 'stm',
+ CLICKED_RESUME: 'hcc',
+ CLICKED_RESTART: 'hcr',
+ CLICKED_DEBUG: 'hcd',
+ WAKE_UP_HELPER: 'wuh'
+};
+
+/**
* Source of a hotwording session request.
* @enum {string}
*/
var SessionSource = {
- LAUNCHER: 'launcher'
+ LAUNCHER: 'launcher',
+ NTP: 'ntp'
};
/**
@@ -88,15 +131,19 @@ var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ?
chrome.i18n.getUILanguage() : '';
return {
+ CLIENT_PORT_NAME: CLIENT_PORT_NAME,
+ COMMAND_FIELD_NAME: COMMAND_FIELD_NAME,
SHARED_MODULE_ID: SHARED_MODULE_ID,
SHARED_MODULE_ROOT: SHARED_MODULE_ROOT,
- TimeoutMs: TimeoutMs,
- File: File,
+ UI_LANGUAGE: UI_LANGUAGE,
+ CommandToPage: CommandToPage,
+ CommandFromPage: CommandFromPage,
Error: Error,
Event: Event,
+ File: File,
NaClPlugin: NaClPlugin,
SessionSource: SessionSource,
- UI_LANGUAGE: UI_LANGUAGE
+ TimeoutMs: TimeoutMs
};
});
« no previous file with comments | « chrome/browser/resources/hotword/audio_client.js ('k') | chrome/browser/resources/hotword/manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698