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).
11 * @extends {SettingsDialog}
13 function PointerOverlay() {
14 // The title is updated dynamically in the setTitle method as pointer
15 // devices are discovered or removed.
16 SettingsDialog.call(this, 'pointer-overlay',
17 '', 'pointer-overlay',
18 $('pointer-overlay-confirm'),
19 $('pointer-overlay-cancel'));
22 cr.addSingletonGetter(PointerOverlay);
24 PointerOverlay.prototype = {
25 __proto__: SettingsDialog.prototype,
28 * Initialize the page.
30 initializePage: function() {
31 // Call base class implementation to start preference initialization.
32 SettingsDialog.prototype.initializePage.call(this);
37 * Sets the visibility state of the touchpad group.
38 * @param {boolean} show True to show, false to hide.
40 PointerOverlay.showTouchpadControls = function(show) {
41 $('pointer-section-touchpad').hidden = !show;
45 * Sets the visibility state of the mouse group.
46 * @param {boolean} show True to show, false to hide.
48 PointerOverlay.showMouseControls = function(show) {
49 $('pointer-section-mouse').hidden = !show;
53 * Updates the title of the pointer dialog. The title is set dynamically
54 * based on whether a touchpad, mouse or both are present. The label on the
55 * button that activates the overlay is also updated to stay in sync. A
56 * message is displayed in the main settings page if no pointer devices are
58 * @param {string} label i18n key for the overlay title.
60 PointerOverlay.setTitle = function(label) {
61 var button = $('pointer-settings-button');
62 var noPointersLabel = $('no-pointing-devices');
63 if (label.length > 0) {
64 var title = loadTimeData.getString(label);
65 button.textContent = title;
66 button.hidden = false;
67 noPointersLabel.hidden = true;
70 noPointersLabel.hidden = false;
76 PointerOverlay: PointerOverlay