1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr
.define('options', function() {
6 /** @const */ var SettingsDialog
= options
.SettingsDialog
;
10 * Dialog that allows users to set pointer settings (touchpad/mouse).
12 * @extends {options.SettingsDialog}
14 function PointerOverlay() {
15 // The title is updated dynamically in the setTitle method as pointer
16 // devices are discovered or removed.
17 SettingsDialog
.call(this, 'pointer-overlay',
18 '', 'pointer-overlay',
19 assertInstanceof($('pointer-overlay-confirm'), HTMLButtonElement
),
20 assertInstanceof($('pointer-overlay-cancel'), HTMLButtonElement
));
23 cr
.addSingletonGetter(PointerOverlay
);
25 PointerOverlay
.prototype = {
26 __proto__
: SettingsDialog
.prototype,
30 * Sets the visibility state of the touchpad group.
31 * @param {boolean} show True to show, false to hide.
33 PointerOverlay
.showTouchpadControls = function(show
) {
34 $('pointer-section-touchpad').hidden
= !show
;
38 * Sets the visibility state of the mouse group.
39 * @param {boolean} show True to show, false to hide.
41 PointerOverlay
.showMouseControls = function(show
) {
42 $('pointer-section-mouse').hidden
= !show
;
46 * Updates the title of the pointer dialog. The title is set dynamically
47 * based on whether a touchpad, mouse or both are present. The label on the
48 * button that activates the overlay is also updated to stay in sync. A
49 * message is displayed in the main settings page if no pointer devices are
51 * @param {string} label i18n key for the overlay title.
53 PointerOverlay
.setTitle = function(label
) {
54 var button
= $('pointer-settings-button');
55 var noPointersLabel
= $('no-pointing-devices');
56 if (label
.length
> 0) {
57 var title
= loadTimeData
.getString(label
);
58 button
.textContent
= title
;
59 button
.hidden
= false;
60 noPointersLabel
.hidden
= true;
63 noPointersLabel
.hidden
= false;
69 PointerOverlay
: PointerOverlay