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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('hotword.constants', function() { 5 cr.define('hotword.constants', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Hotword data shared module extension's ID. 9 * Hotword data shared module extension's ID.
10 * @const {string} 10 * @const {string}
11 */ 11 */
12 var SHARED_MODULE_ID = 'lccekmodgklaepjeofjdjpbminllajkg'; 12 var SHARED_MODULE_ID = 'lccekmodgklaepjeofjdjpbminllajkg';
13 13
14 /** 14 /**
15 * Path to shared module data. 15 * Path to shared module data.
16 * @const {string} 16 * @const {string}
17 */ 17 */
18 var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID; 18 var SHARED_MODULE_ROOT = '_modules/' + SHARED_MODULE_ID;
19 19
20 /** 20 /**
21 * Name used by the content scripts to create communications Ports.
22 * @const {string}
23 */
24 var CLIENT_PORT_NAME = 'chwcpn';
25
26 /**
27 * The field name to specify the command among pages.
28 * @const {string}
29 */
30 var COMMAND_FIELD_NAME = 'cmd';
31
32 /**
21 * Time to wait for expected messages, in milliseconds. 33 * Time to wait for expected messages, in milliseconds.
22 * @enum {number} 34 * @enum {number}
23 */ 35 */
24 var TimeoutMs = { 36 var TimeoutMs = {
25 SHORT: 200, 37 SHORT: 200,
26 NORMAL: 500, 38 NORMAL: 500,
27 LONG: 2000 39 LONG: 2000
28 }; 40 };
29 41
30 /** 42 /**
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 STOP: 's', 78 STOP: 's',
67 REQUEST_MODEL: 'model', 79 REQUEST_MODEL: 'model',
68 MODEL_LOADED: 'model_loaded', 80 MODEL_LOADED: 'model_loaded',
69 READY_FOR_AUDIO: 'audio', 81 READY_FOR_AUDIO: 'audio',
70 STOPPED: 'stopped', 82 STOPPED: 'stopped',
71 HOTWORD_DETECTED: 'hotword', 83 HOTWORD_DETECTED: 'hotword',
72 MS_CONFIGURED: 'ms_configured' 84 MS_CONFIGURED: 'ms_configured'
73 }; 85 };
74 86
75 /** 87 /**
88 * Messages sent from the injected scripts to the Google page.
89 * @enum {string}
90 */
91 var CommandToPage = {
92 HOTWORD_VOICE_TRIGGER: 'vt',
93 HOTWORD_STARTED: 'hs',
94 HOTWORD_ENDED: 'hd',
95 HOTWORD_TIMEOUT: 'ht',
96 HOTWORD_ERROR: 'he'
97 };
98
99 /**
100 * Messages sent from the Google page to the injected scripts
101 * and then passed to the extension.
102 * @enum {string}
103 */
104 var CommandFromPage = {
105 SPEECH_START: 'ss',
106 SPEECH_END: 'se',
107 SPEECH_RESET: 'sr',
108 SHOWING_HOTWORD_START: 'shs',
109 SHOWING_ERROR_MESSAGE: 'sem',
110 SHOWING_TIMEOUT_MESSAGE: 'stm',
111 CLICKED_RESUME: 'hcc',
112 CLICKED_RESTART: 'hcr',
113 CLICKED_DEBUG: 'hcd',
114 WAKE_UP_HELPER: 'wuh'
115 };
116
117 /**
76 * Source of a hotwording session request. 118 * Source of a hotwording session request.
77 * @enum {string} 119 * @enum {string}
78 */ 120 */
79 var SessionSource = { 121 var SessionSource = {
80 LAUNCHER: 'launcher' 122 LAUNCHER: 'launcher',
123 NTP: 'ntp'
81 }; 124 };
82 125
83 /** 126 /**
84 * The browser UI language. 127 * The browser UI language.
85 * @const {string} 128 * @const {string}
86 */ 129 */
87 var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ? 130 var UI_LANGUAGE = (chrome.i18n && chrome.i18n.getUILanguage) ?
88 chrome.i18n.getUILanguage() : ''; 131 chrome.i18n.getUILanguage() : '';
89 132
90 return { 133 return {
91 SHARED_MODULE_ID: SHARED_MODULE_ID, 134 SHARED_MODULE_ID: SHARED_MODULE_ID,
92 SHARED_MODULE_ROOT: SHARED_MODULE_ROOT, 135 SHARED_MODULE_ROOT: SHARED_MODULE_ROOT,
136 CLIENT_PORT_NAME: CLIENT_PORT_NAME,
137 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.
93 TimeoutMs: TimeoutMs, 138 TimeoutMs: TimeoutMs,
94 File: File, 139 File: File,
95 Error: Error, 140 Error: Error,
96 Event: Event, 141 Event: Event,
97 NaClPlugin: NaClPlugin, 142 NaClPlugin: NaClPlugin,
143 CommandToPage: CommandToPage,
144 CommandFromPage: CommandFromPage,
98 SessionSource: SessionSource, 145 SessionSource: SessionSource,
99 UI_LANGUAGE: UI_LANGUAGE 146 UI_LANGUAGE: UI_LANGUAGE
100 }; 147 };
101 148
102 }); 149 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698