Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Unified Diff: chrome/browser/resources/options/chromeos/system_options.js

Issue 8340002: Enable brightness controls for all ChromeOS builds. Make brightness controls auto-repeat. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup event listener. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a447a26b04696a181b3b3985a99eaaddd390bba4 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,24 @@ 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);
+ button.addEventListener(RepeatingButton.Event.BUTTON_HELD, function(e) {
chrome.send(callback);
- }
+ });
}
/**
« no previous file with comments | « chrome/browser/resources/options/chromeos/system_options.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698