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

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: Rebase. 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
Index: chrome/browser/resources/hotword/constants.js
diff --git a/chrome/browser/resources/hotword/constants.js b/chrome/browser/resources/hotword/constants.js
index 236d2201ae4f9507f4a94e19444ae5656bada712..ebc6ec8a0f20bfd3035cc12007d4d61fc0d757c8 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'
};
/**
@@ -90,11 +133,15 @@ var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ?
return {
SHARED_MODULE_ID: SHARED_MODULE_ID,
SHARED_MODULE_ROOT: SHARED_MODULE_ROOT,
+ CLIENT_PORT_NAME: CLIENT_PORT_NAME,
+ COMMAND_FIELD_NAME: COMMAND_FIELD_NAME,
Dan Beam 2014/10/09 22:43:58 nit: alphabetize
Anand Mistry (off Chromium) 2014/10/10 23:11:44 Done.
Dan Beam 2014/10/11 00:54:35 thanks for doing this. what you have works, but I
Anand Mistry (off Chromium) 2014/10/13 19:30:20 Gotcha! Fixed that.
TimeoutMs: TimeoutMs,
File: File,
Error: Error,
Event: Event,
NaClPlugin: NaClPlugin,
+ CommandToPage: CommandToPage,
+ CommandFromPage: CommandFromPage,
SessionSource: SessionSource,
UI_LANGUAGE: UI_LANGUAGE
};

Powered by Google App Engine
This is Rietveld 408576698