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 959e8a0945c5f03aaa5a03bb599865ac9dc7bb25..53142c2b589ff2cea87d0d0eea7e88c92a897e3e 100644 |
| --- a/chrome/browser/resources/options/chromeos/system_options.js |
| +++ b/chrome/browser/resources/options/chromeos/system_options.js |
| @@ -41,9 +41,17 @@ cr.define('options', function() { |
| use_24hour_clock.disabled = true; |
| } |
| + options.system.bluetooth.BluetoothListElement.decorate( |
| + $('bluetooth-device-list')); |
| + |
| // TODO (kevers) - Populate list of connected bluetooth devices. |
| // Set state of 'Enable bluetooth' checkbox. |
| - // Set state of 'Find devices' button. |
| + |
| + $('bluetooth-find-devices').disabled = $('enable-bluetooth-label') ? |
|
James Hawkins
2011/10/04 20:43:39
Wrap after '='.
kevers
2011/10/05 14:23:01
Done.
|
| + false : true; |
| + $('bluetooth-find-devices').onclick = function(event) { |
| + findBluetoothDevices_(); |
| + }; |
| $('language-button').onclick = function(event) { |
| OptionsPage.navigateToPage('language'); |
| @@ -76,6 +84,53 @@ cr.define('options', function() { |
| $('bluetooth-devices').hidden = false; |
| } |
| + /** |
| + * Adds an element to the list of available bluetooth devices. |
| + * @param{{'deviceName': string, |
| + * 'deviceId': string, |
| + * 'deviceType': Constants.DEVICE_TYPE, |
| + * 'deviceStatus': Constants.DEVICE_STATUS} device |
| + * Decription of the bluetooth device. |
| + */ |
| + SystemOptions.AddBluetoothDevice = function(device) { |
| + $('bluetooth-device-list').appendDevice(device); |
| + } |
| + |
| + /** |
| + * Hides the scanning label and icon that are used to indicate that a device |
| + * search is in progress. |
| + */ |
| + SystemOptions.NotifyBluetoothSearchComplete = function() { |
| + // TODO (kevers) - reset state immediately once fake response is made |
| + // asynchronously. |
| + setTimeout( function() { |
| + $('bluetooth-scanning-label').hidden = true; |
| + $('bluetooth-scanning-icon').hidden = true; |
|
James Hawkins
2011/10/04 20:43:39
Are these hides animated?
kevers
2011/10/05 14:23:01
No, the transition is not animated. Is there a su
kevers
2011/10/05 20:32:39
The call to setTimeout is a temporary visual hack
James Hawkins
2011/10/05 20:35:28
Yes, hides should be animated...I'm not sure about
kevers
2011/10/06 14:51:25
The hide now has a 0.25s fade animation.
|
| + }, 2000); |
| + } |
| + |
| + /** |
| + * Scan for bluetooth devices. |
| + * @private |
| + */ |
| + function findBluetoothDevices_() { |
| + console.log('Scanning for bluetooth devices.'); |
|
James Hawkins
2011/10/04 20:43:39
Remove console spam.
kevers
2011/10/05 14:23:01
Oops. My bad.
|
| + $('bluetooth-scanning-label').hidden = false; |
| + $('bluetooth-scanning-icon').hidden = false; |
| + |
| + // Remove devices that are not currently connected. |
| + var devices = $('bluetooth-device-list').childNodes; |
| + for (var i = devices.length - 1; i >= 0; i--) { |
| + var device = devices.item(i); |
| + var data = device.data; |
| + if (!data || data.status !== 'connected') |
| + $('bluetooth-device-list').removeChild(device); |
| + } |
| + // TODO (kevers) - Set arguments to a list of the currently connected |
| + // devices. |
| + chrome.send('findBluetoothDevices', []); |
|
James Hawkins
2011/10/04 20:43:39
No need for final (empty) parameter.
kevers
2011/10/05 14:23:01
Done.
|
| + } |
| + |
| // Export |
| return { |
| SystemOptions: SystemOptions |