1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
cr.define('options', function() {
/**
* Encapsulated handling of the keyboard overlay.
* @constructor
*/
function KeyboardOverlay() {
options.SettingsDialog.call(this, 'keyboard-overlay',
loadTimeData.getString('keyboardOverlayTitle'),
'keyboard-overlay',
$('keyboard-confirm'), $('keyboard-cancel'));
}
cr.addSingletonGetter(KeyboardOverlay);
KeyboardOverlay.prototype = {
__proto__: options.SettingsDialog.prototype,
/**
* Initializes the page. This method is called in initialize.
*/
initializePage: function() {
options.SettingsDialog.prototype.initializePage.call(this);
$('languages-and-input-settings').onclick = function(e) {
OptionsPage.navigateToPage('languages');
chrome.send('coreOptionsUserMetricsAction',
['Options_KeyboardShowLanguageSettings']);
};
$('keyboard-shortcuts').onclick = function(e) {
chrome.send('showKeyboardShortcuts');
chrome.send('coreOptionsUserMetricsAction',
['Options_KeyboardShowKeyboardShortcuts']);
};
},
/**
* Show/hide the caps lock remapping section.
* @private
*/
showCapsLockOptions_: function(show) {
$('caps-lock-remapping-section').hidden = !show;
},
/**
* Show/hide the diamond key remapping section.
* @private
*/
showDiamondKeyOptions_: function(show) {
$('diamond-key-remapping-section').hidden = !show;
},
};
// Forward public APIs to private implementations.
[
'showCapsLockOptions',
'showDiamondKeyOptions',
].forEach(function(name) {
KeyboardOverlay[name] = function() {
var instance = KeyboardOverlay.getInstance();
return instance[name + '_'].apply(instance, arguments);
};
});
// Export
return {
KeyboardOverlay: KeyboardOverlay
};
});
|