Chromium Code Reviews| Index: chrome/browser/resources/options2/browser_options.js |
| =================================================================== |
| --- chrome/browser/resources/options2/browser_options.js (revision 117867) |
| +++ chrome/browser/resources/options2/browser_options.js (working copy) |
| @@ -5,6 +5,7 @@ |
| cr.define('options', function() { |
| const OptionsPage = options.OptionsPage; |
| const ArrayDataModel = cr.ui.ArrayDataModel; |
| + var RepeatingButton = cr.ui.RepeatingButton; |
| // |
| // BrowserOptions class |
| @@ -76,6 +77,20 @@ |
| chrome.send('themesReset'); |
| }; |
| + // Device section (ChromeOS only). |
| + if (cr.isChromeOS) { |
| + $('keyboard-settings-button').onclick = function(event) { |
| + OptionsPage.navigateToPage('keyboard-overlay'); |
| + }; |
| + $('pointer-settings-button').onclick = function(event) { |
| + OptionsPage.navigateToPage('pointer-overlay'); |
| + }; |
| + this.initBrightnessButton_('brightness-decrease-button', |
| + 'decreaseScreenBrightness'); |
| + this.initBrightnessButton_('brightness-increase-button', |
| + 'increaseScreenBrightness'); |
| + } |
| + |
| // Search section. |
| $('defaultSearchManageEnginesButton').onclick = function(event) { |
| OptionsPage.navigateToPage('searchEngines'); |
| @@ -190,11 +205,25 @@ |
| }; |
| }, |
| + /** |
| + * Initializes a button for controlling screen brightness. |
| + * @param {string} id Button ID. |
| + * @param {string} callback Name of the callback function. |
| + */ |
| + initBrightnessButton_: function(id, callback) { |
| + var button = $(id); |
| + cr.ui.decorate(button, RepeatingButton); |
| + button.repeatInterval = 300; |
| + button.addEventListener(RepeatingButton.Event.BUTTON_HELD, function(e) { |
| + chrome.send(callback); |
| + }); |
| + }, |
| + |
| setSyncEnabled_: function(enabled) { |
| this.syncEnabled = enabled; |
| }, |
| - setAutoLoginVisible_ : function(visible) { |
| + setAutoLoginVisible_: function(visible) { |
| $('enable-auto-login-checkbox').hidden = !visible; |
| }, |
| @@ -510,6 +539,22 @@ |
| 'chrome://userimage/' + this.username_ + |
| '?id=' + (new Date()).getTime(); |
| }, |
| + |
| + /** |
| + * Displays the touchpad controls section when we detect a touchpad, hides |
| + it otherwise. |
|
James Hawkins
2012/01/17 16:23:39
@private, @param. Same for the method below it.
csilv
2012/01/17 17:58:49
Done.
|
| + */ |
| + showTouchpadControls_: function() { |
|
James Hawkins
2012/01/17 16:23:39
Missing a |show| parameter here.
csilv
2012/01/17 17:58:49
Done.
|
| + $('touchpad-controls').hidden = !show; |
| + }, |
| + |
| + /** |
| + * Displays the mouse controls section when we detect a mouse, hides it |
| + * otherwise. |
| + */ |
| + showMouseControls_: function(show) { |
| + $('mouse-controls').hidden = !show; |
| + }, |
| }; |
| //Forward public APIs to private implementations. |
| @@ -537,6 +582,8 @@ |
| 'updateHomePageLabel', |
| 'updateSearchEngines', |
| 'updateStartupPages', |
| + 'showTouchpadControls', |
| + 'showMouseControls', |
| ].forEach(function(name) { |
| BrowserOptions[name] = function(value) { |
| return BrowserOptions.getInstance()[name + '_'](value); |