OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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('options', function() { | 5 cr.define('options', function() { |
6 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 var RepeatingButton = cr.ui.RepeatingButton; | |
9 | |
8 ///////////////////////////////////////////////////////////////////////////// | 10 ///////////////////////////////////////////////////////////////////////////// |
9 // SystemOptions class: | 11 // SystemOptions class: |
10 | 12 |
11 /** | 13 /** |
12 * Encapsulated handling of ChromeOS system options page. | 14 * Encapsulated handling of ChromeOS system options page. |
13 * @constructor | 15 * @constructor |
14 */ | 16 */ |
15 | 17 |
16 function SystemOptions() { | 18 function SystemOptions() { |
17 OptionsPage.call(this, 'system', templateData.systemPageTabTitle, | 19 OptionsPage.call(this, 'system', templateData.systemPageTabTitle, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 $('language-button').onclick = function(event) { | 58 $('language-button').onclick = function(event) { |
57 OptionsPage.navigateToPage('language'); | 59 OptionsPage.navigateToPage('language'); |
58 }; | 60 }; |
59 $('modifier-keys-button').onclick = function(event) { | 61 $('modifier-keys-button').onclick = function(event) { |
60 OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); | 62 OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); |
61 }; | 63 }; |
62 $('accesibility-check').onchange = function(event) { | 64 $('accesibility-check').onchange = function(event) { |
63 chrome.send('accessibilityChange', | 65 chrome.send('accessibilityChange', |
64 [String($('accesibility-check').checked)]); | 66 [String($('accesibility-check').checked)]); |
65 }; | 67 }; |
66 | 68 initializeBrightnessButton_('brightness-decrease-button', |
67 if (cr.isTouch) { | 69 'decreaseScreenBrightness'); |
68 initializeBrightnessButton_('brightness-decrease-button', | 70 initializeBrightnessButton_('brightness-increase-button', |
69 'decreaseScreenBrightness'); | 71 'increaseScreenBrightness'); |
70 initializeBrightnessButton_('brightness-increase-button', | |
71 'increaseScreenBrightness'); | |
72 } | |
73 } | 72 } |
74 }; | 73 }; |
75 | 74 |
76 /** | 75 /** |
77 * Initializes a button for controlling screen brightness on touch builds of | 76 * Initializes a button for controlling screen brightness. |
78 * ChromeOS. | |
79 * @param {string} id Button ID. | 77 * @param {string} id Button ID. |
80 * @param {string} callback Name of the callback function. | 78 * @param {string} callback Name of the callback function. |
81 */ | 79 */ |
82 function initializeBrightnessButton_(id, callback) { | 80 function initializeBrightnessButton_(id, callback) { |
83 // TODO(kevers): Make brightness buttons auto-repeat if held. | 81 var button = $(id); |
84 $(id).onclick = function(event) { | 82 cr.ui.decorate(button, RepeatingButton); |
83 var handler = function(e) { | |
85 chrome.send(callback); | 84 chrome.send(callback); |
86 } | 85 } |
86 button.addEventListener(RepeatingButton.Event.BUTTON_HELD, handler); | |
Rick Byers
2011/10/31 19:23:20
style nit: please just put the anonymous function
| |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * Scan for bluetooth devices. | 90 * Scan for bluetooth devices. |
91 * @private | 91 * @private |
92 */ | 92 */ |
93 function findBluetoothDevices_() { | 93 function findBluetoothDevices_() { |
94 setVisibility_('bluetooth-scanning-label', true); | 94 setVisibility_('bluetooth-scanning-label', true); |
95 setVisibility_('bluetooth-scanning-icon', true); | 95 setVisibility_('bluetooth-scanning-icon', true); |
96 | 96 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 SystemOptions.showTapToClick = function() { | 169 SystemOptions.showTapToClick = function() { |
170 $('tap-to-click').hidden = false; | 170 $('tap-to-click').hidden = false; |
171 }; | 171 }; |
172 | 172 |
173 // Export | 173 // Export |
174 return { | 174 return { |
175 SystemOptions: SystemOptions | 175 SystemOptions: SystemOptions |
176 }; | 176 }; |
177 | 177 |
178 }); | 178 }); |
OLD | NEW |