OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 | 9 |
10 // | 10 // |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 chrome.send('metricsReportingCheckboxAction', | 266 chrome.send('metricsReportingCheckboxAction', |
267 [String(event.target.checked)]); | 267 [String(event.target.checked)]); |
268 }; | 268 }; |
269 } | 269 } |
270 | 270 |
271 // Bluetooth (CrOS only). | 271 // Bluetooth (CrOS only). |
272 if (cr.isChromeOS) { | 272 if (cr.isChromeOS) { |
273 options.system.bluetooth.BluetoothDeviceList.decorate( | 273 options.system.bluetooth.BluetoothDeviceList.decorate( |
274 $('bluetooth-paired-devices-list')); | 274 $('bluetooth-paired-devices-list')); |
275 | 275 |
276 $('bluetooth-add-device').onclick = function(event) { | 276 $('bluetooth-add-device').onclick = |
277 this.findBluetoothDevices_(true); | 277 this.handleAddBluetoothDevice_.bind(this); |
278 OptionsPage.navigateToPage('bluetooth'); | |
279 }; | |
280 | 278 |
281 $('enable-bluetooth').onchange = function(event) { | 279 $('enable-bluetooth').onchange = function(event) { |
282 var state = $('enable-bluetooth').checked; | 280 var state = $('enable-bluetooth').checked; |
283 chrome.send('bluetoothEnableChange', [Boolean(state)]); | 281 chrome.send('bluetoothEnableChange', [Boolean(state)]); |
284 }; | 282 }; |
285 | 283 |
286 $('bluetooth-reconnect-device').onclick = function(event) { | 284 $('bluetooth-reconnect-device').onclick = function(event) { |
287 var device = $('bluetooth-paired-devices-list').selectedItem; | 285 var device = $('bluetooth-paired-devices-list').selectedItem; |
288 var address = device.address; | 286 var address = device.address; |
289 chrome.send('updateBluetoothDevice', [address, 'connect']); | 287 chrome.send('updateBluetoothDevice', [address, 'connect']); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 $('advanced-settings-container').offsetHeight + 20 + 'px'; | 472 $('advanced-settings-container').offsetHeight + 20 + 'px'; |
475 $('advanced-settings-expander').innerHTML = | 473 $('advanced-settings-expander').innerHTML = |
476 localStrings.getString('hideAdvancedSettings'); | 474 localStrings.getString('hideAdvancedSettings'); |
477 }, | 475 }, |
478 | 476 |
479 /** | 477 /** |
480 * Hide advanced settings. | 478 * Hide advanced settings. |
481 * @private | 479 * @private |
482 */ | 480 */ |
483 hideAdvancedSettings_: function() { | 481 hideAdvancedSettings_: function() { |
484 $('advanced-settings').style.height = '0px' | 482 $('advanced-settings').style.height = '0px'; |
485 $('advanced-settings-expander').innerHTML = | 483 $('advanced-settings-expander').innerHTML = |
486 localStrings.getString('showAdvancedSettings'); | 484 localStrings.getString('showAdvancedSettings'); |
487 }, | 485 }, |
488 | 486 |
489 /** | 487 /** |
490 * Updates managed banner visibility state. This function iterates over | 488 * Updates managed banner visibility state. This function iterates over |
491 * all input fields of all subpages and if any of these is marked as managed | 489 * all input fields of all subpages and if any of these is marked as managed |
492 * it triggers the managed banner to be visible. | 490 * it triggers the managed banner to be visible. |
493 * @private | 491 * @private |
494 */ | 492 */ |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 */ | 946 */ |
949 updateAccountPicture_: function() { | 947 updateAccountPicture_: function() { |
950 var picture = $('account-picture'); | 948 var picture = $('account-picture'); |
951 if (picture) { | 949 if (picture) { |
952 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + | 950 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + |
953 Date.now(); | 951 Date.now(); |
954 } | 952 } |
955 }, | 953 }, |
956 | 954 |
957 /** | 955 /** |
958 * Scan for bluetooth devices. | 956 * Handle the 'add device' button click. |
959 * @param {boolean} reset Indicates if the list of unpaired devices should | |
960 * be cleared. | |
961 * @private | 957 * @private |
962 */ | 958 */ |
963 findBluetoothDevices_: function(reset) { | 959 handleAddBluetoothDevice_: function() { |
964 $('bluetooth-unpaired-devices-list').clear(); | 960 $('bluetooth-unpaired-devices-list').clear(); |
965 chrome.send('findBluetoothDevices'); | 961 chrome.send('findBluetoothDevices'); |
| 962 OptionsPage.navigateToPage('bluetooth'); |
966 }, | 963 }, |
967 | 964 |
968 /** | 965 /** |
969 * Set the checked state of the metrics reporting checkbox. | 966 * Set the checked state of the metrics reporting checkbox. |
970 * @private | 967 * @private |
971 */ | 968 */ |
972 setMetricsReportingCheckboxState_: function(checked, disabled) { | 969 setMetricsReportingCheckboxState_: function(checked, disabled) { |
973 $('metricsReportingEnabled').checked = checked; | 970 $('metricsReportingEnabled').checked = checked; |
974 $('metricsReportingEnabled').disabled = disabled; | 971 $('metricsReportingEnabled').disabled = disabled; |
975 if (disabled) | 972 if (disabled) |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 BrowserOptions.getLoggedInUsername = function() { | 1257 BrowserOptions.getLoggedInUsername = function() { |
1261 return BrowserOptions.getInstance().username_; | 1258 return BrowserOptions.getInstance().username_; |
1262 }; | 1259 }; |
1263 } | 1260 } |
1264 | 1261 |
1265 // Export | 1262 // Export |
1266 return { | 1263 return { |
1267 BrowserOptions: BrowserOptions | 1264 BrowserOptions: BrowserOptions |
1268 }; | 1265 }; |
1269 }); | 1266 }); |
OLD | NEW |