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

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

Powered by Google App Engine
This is Rietveld 408576698