Chromium Code Reviews| 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 ///////////////////////////////////////////////////////////////////////////// | 8 ///////////////////////////////////////////////////////////////////////////// |
| 9 // SystemOptions class: | 9 // SystemOptions class: |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 // Disable time-related settings if we're not logged in as a real user. | 34 // Disable time-related settings if we're not logged in as a real user. |
| 35 if (AccountsOptions.loggedInAsGuest()) { | 35 if (AccountsOptions.loggedInAsGuest()) { |
| 36 var timezone = $('timezone-select'); | 36 var timezone = $('timezone-select'); |
| 37 if (timezone) | 37 if (timezone) |
| 38 timezone.disabled = true; | 38 timezone.disabled = true; |
| 39 var use_24hour_clock = $('use-24hour-clock'); | 39 var use_24hour_clock = $('use-24hour-clock'); |
| 40 if (use_24hour_clock) | 40 if (use_24hour_clock) |
| 41 use_24hour_clock.disabled = true; | 41 use_24hour_clock.disabled = true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 options.system.bluetooth.BluetoothListElement.decorate( | |
| 45 $('bluetooth-device-list')); | |
| 46 | |
| 44 // TODO (kevers) - Populate list of connected bluetooth devices. | 47 // TODO (kevers) - Populate list of connected bluetooth devices. |
| 45 // Set state of 'Enable bluetooth' checkbox. | 48 // Set state of 'Enable bluetooth' checkbox. |
| 46 // Set state of 'Find devices' button. | 49 |
| 50 $('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.
| |
| 51 false : true; | |
| 52 $('bluetooth-find-devices').onclick = function(event) { | |
| 53 findBluetoothDevices_(); | |
| 54 }; | |
| 47 | 55 |
| 48 $('language-button').onclick = function(event) { | 56 $('language-button').onclick = function(event) { |
| 49 OptionsPage.navigateToPage('language'); | 57 OptionsPage.navigateToPage('language'); |
| 50 }; | 58 }; |
| 51 $('modifier-keys-button').onclick = function(event) { | 59 $('modifier-keys-button').onclick = function(event) { |
| 52 OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); | 60 OptionsPage.navigateToPage('languageCustomizeModifierKeysOverlay'); |
| 53 }; | 61 }; |
| 54 $('accesibility-check').onchange = function(event) { | 62 $('accesibility-check').onchange = function(event) { |
| 55 chrome.send('accessibilityChange', | 63 chrome.send('accessibilityChange', |
| 56 [String($('accesibility-check').checked)]); | 64 [String($('accesibility-check').checked)]); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 69 $('accesibility-check').checked = checked; | 77 $('accesibility-check').checked = checked; |
| 70 }; | 78 }; |
| 71 | 79 |
| 72 /** | 80 /** |
| 73 * Activate the bluetooth settings section on the System settings page. | 81 * Activate the bluetooth settings section on the System settings page. |
| 74 */ | 82 */ |
| 75 SystemOptions.ShowBluetoothSettings = function() { | 83 SystemOptions.ShowBluetoothSettings = function() { |
| 76 $('bluetooth-devices').hidden = false; | 84 $('bluetooth-devices').hidden = false; |
| 77 } | 85 } |
| 78 | 86 |
| 87 /** | |
| 88 * Adds an element to the list of available bluetooth devices. | |
| 89 * @param{{'deviceName': string, | |
| 90 * 'deviceId': string, | |
| 91 * 'deviceType': Constants.DEVICE_TYPE, | |
| 92 * 'deviceStatus': Constants.DEVICE_STATUS} device | |
| 93 * Decription of the bluetooth device. | |
| 94 */ | |
| 95 SystemOptions.AddBluetoothDevice = function(device) { | |
| 96 $('bluetooth-device-list').appendDevice(device); | |
| 97 } | |
| 98 | |
| 99 /** | |
| 100 * Hides the scanning label and icon that are used to indicate that a device | |
| 101 * search is in progress. | |
| 102 */ | |
| 103 SystemOptions.NotifyBluetoothSearchComplete = function() { | |
| 104 // TODO (kevers) - reset state immediately once fake response is made | |
| 105 // asynchronously. | |
| 106 setTimeout( function() { | |
| 107 $('bluetooth-scanning-label').hidden = true; | |
| 108 $('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.
| |
| 109 }, 2000); | |
| 110 } | |
| 111 | |
| 112 /** | |
| 113 * Scan for bluetooth devices. | |
| 114 * @private | |
| 115 */ | |
| 116 function findBluetoothDevices_() { | |
| 117 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.
| |
| 118 $('bluetooth-scanning-label').hidden = false; | |
| 119 $('bluetooth-scanning-icon').hidden = false; | |
| 120 | |
| 121 // Remove devices that are not currently connected. | |
| 122 var devices = $('bluetooth-device-list').childNodes; | |
| 123 for (var i = devices.length - 1; i >= 0; i--) { | |
| 124 var device = devices.item(i); | |
| 125 var data = device.data; | |
| 126 if (!data || data.status !== 'connected') | |
| 127 $('bluetooth-device-list').removeChild(device); | |
| 128 } | |
| 129 // TODO (kevers) - Set arguments to a list of the currently connected | |
| 130 // devices. | |
| 131 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.
| |
| 132 } | |
| 133 | |
| 79 // Export | 134 // Export |
| 80 return { | 135 return { |
| 81 SystemOptions: SystemOptions | 136 SystemOptions: SystemOptions |
| 82 }; | 137 }; |
| 83 | 138 |
| 84 }); | 139 }); |
| OLD | NEW |