Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/system_options.js |
| diff --git a/chrome/browser/resources/options/chromeos/system_options.js b/chrome/browser/resources/options/chromeos/system_options.js |
| index 56ccd2636f19605e62367fb7e4b2e3c2b85890ae..80b04ce42054118bc7dad99cbdb6dca4d1635ba4 100644 |
| --- a/chrome/browser/resources/options/chromeos/system_options.js |
| +++ b/chrome/browser/resources/options/chromeos/system_options.js |
| @@ -5,6 +5,8 @@ |
| cr.define('options', function() { |
| var OptionsPage = options.OptionsPage; |
| + var RepeatingButton = cr.ui.RepeatingButton; |
| + |
| ///////////////////////////////////////////////////////////////////////////// |
| // SystemOptions class: |
| @@ -63,27 +65,25 @@ cr.define('options', function() { |
| chrome.send('accessibilityChange', |
| [String($('accesibility-check').checked)]); |
| }; |
| - |
| - if (cr.isTouch) { |
| - initializeBrightnessButton_('brightness-decrease-button', |
| - 'decreaseScreenBrightness'); |
| - initializeBrightnessButton_('brightness-increase-button', |
| - 'increaseScreenBrightness'); |
| - } |
| + initializeBrightnessButton_('brightness-decrease-button', |
| + 'decreaseScreenBrightness'); |
| + initializeBrightnessButton_('brightness-increase-button', |
| + 'increaseScreenBrightness'); |
| } |
| }; |
| /** |
| - * Initializes a button for controlling screen brightness on touch builds of |
| - * ChromeOS. |
| + * Initializes a button for controlling screen brightness. |
| * @param {string} id Button ID. |
| * @param {string} callback Name of the callback function. |
| */ |
| function initializeBrightnessButton_(id, callback) { |
| - // TODO(kevers): Make brightness buttons auto-repeat if held. |
| - $(id).onclick = function(event) { |
| + var button = $(id); |
| + cr.ui.decorate(button, RepeatingButton); |
| + var handler = function(e) { |
| chrome.send(callback); |
| } |
| + button.addEventListener(RepeatingButton.Event.BUTTON_HELD, handler); |
|
Rick Byers
2011/10/31 19:23:20
style nit: please just put the anonymous function
|
| } |
| /** |