OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class managing the host's available keyboard layouts, allowing the user to | 7 * Class managing the host's available keyboard layouts, allowing the user to |
8 * select one that matches the local layout, or auto-selecting based on the | 8 * select one that matches the local layout, or auto-selecting based on the |
9 * current locale. | 9 * current locale. |
10 */ | 10 */ |
11 | 11 |
12 'use strict'; | 12 'use strict'; |
13 | 13 |
14 /** @suppress {duplicate} */ | 14 /** @suppress {duplicate} */ |
15 var remoting = remoting || {}; | 15 var remoting = remoting || {}; |
16 | 16 |
17 /** | 17 /** |
18 * @param {remoting.ContextMenuAdapter} adapter | 18 * @param {remoting.ContextMenuAdapter} adapter |
19 * @constructor | 19 * @constructor |
20 */ | 20 */ |
21 remoting.KeyboardLayoutsMenu = function(adapter) { | 21 remoting.KeyboardLayoutsMenu = function(adapter) { |
22 /** | 22 /** @private {remoting.ContextMenuAdapter} */ |
23 * @type {remoting.ContextMenuAdapter} | |
24 * @private | |
25 */ | |
26 this.adapter_ = adapter; | 23 this.adapter_ = adapter; |
27 /** | 24 /** @private {remoting.SubmenuManager} */ |
28 * @type {remoting.SubmenuManager} | |
29 * @private | |
30 */ | |
31 this.submenuManager_ = new remoting.SubmenuManager( | 25 this.submenuManager_ = new remoting.SubmenuManager( |
32 adapter, | 26 adapter, |
33 chrome.i18n.getMessage(/*i18n-content*/'KEYBOARD_LAYOUTS_SUBMENU_TITLE'), | 27 chrome.i18n.getMessage(/*i18n-content*/'KEYBOARD_LAYOUTS_SUBMENU_TITLE'), |
34 true); | 28 true); |
35 /** | 29 /** @private {string} */ |
36 * @type {string} | |
37 * @private | |
38 */ | |
39 this.currentLayout_ = ''; | 30 this.currentLayout_ = ''; |
40 | 31 |
41 adapter.addListener(this.onContextMenu_.bind(this)); | 32 adapter.addListener(this.onContextMenu_.bind(this)); |
42 }; | 33 }; |
43 | 34 |
44 /** | 35 /** |
45 * @param {Array<string>} layouts The keyboard layouts available on the host, | 36 * @param {Array<string>} layouts The keyboard layouts available on the host, |
46 * for example en-US, de-DE | 37 * for example en-US, de-DE |
47 * @param {string} currentLayout The layout currently active on the host. | 38 * @param {string} currentLayout The layout currently active on the host. |
48 */ | 39 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 this.makeMenuId_(components[1]) == info.menuItemId) { | 167 this.makeMenuId_(components[1]) == info.menuItemId) { |
177 this.setLayout_(true, components[1]); | 168 this.setLayout_(true, components[1]); |
178 } | 169 } |
179 }; | 170 }; |
180 | 171 |
181 /** | 172 /** |
182 * @type {string} | 173 * @type {string} |
183 * @private | 174 * @private |
184 */ | 175 */ |
185 remoting.KeyboardLayoutsMenu.KEY_ = 'preferred-keyboard-layout'; | 176 remoting.KeyboardLayoutsMenu.KEY_ = 'preferred-keyboard-layout'; |
OLD | NEW |