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 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
7 | 7 |
8 /** | 8 /** |
9 * Encapsulated handling of the Bluetooth options page. | 9 * Encapsulated handling of the Bluetooth options page. |
10 * @constructor | 10 * @constructor |
(...skipping 16 matching lines...) Expand all Loading... |
27 * @private | 27 * @private |
28 */ | 28 */ |
29 deviceList_: null, | 29 deviceList_: null, |
30 | 30 |
31 /** @inheritDoc */ | 31 /** @inheritDoc */ |
32 initializePage: function() { | 32 initializePage: function() { |
33 OptionsPage.prototype.initializePage.call(this); | 33 OptionsPage.prototype.initializePage.call(this); |
34 this.createDeviceList_(); | 34 this.createDeviceList_(); |
35 | 35 |
36 $('bluetooth-add-device-cancel-button').onclick = function(event) { | 36 $('bluetooth-add-device-cancel-button').onclick = function(event) { |
| 37 chrome.send('stopBluetoothDeviceDiscovery'); |
37 OptionsPage.closeOverlay(); | 38 OptionsPage.closeOverlay(); |
38 }; | 39 }; |
39 | 40 |
40 var self = this; | 41 var self = this; |
41 $('bluetooth-add-device-apply-button').onclick = function(event) { | 42 $('bluetooth-add-device-apply-button').onclick = function(event) { |
42 var device = self.deviceList_.selectedItem; | 43 var device = self.deviceList_.selectedItem; |
43 var address = device.address; | 44 var address = device.address; |
| 45 chrome.send('stopBluetoothDeviceDiscovery'); |
44 chrome.send('updateBluetoothDevice', [address, 'connect']); | 46 chrome.send('updateBluetoothDevice', [address, 'connect']); |
45 OptionsPage.closeOverlay(); | 47 OptionsPage.closeOverlay(); |
46 }; | 48 }; |
47 | 49 |
48 $('bluetooth-add-device-apply-button').onmousedown = function(event) { | 50 $('bluetooth-add-device-apply-button').onmousedown = function(event) { |
49 // Prevent 'blur' event, which would reset the list selection, | 51 // Prevent 'blur' event, which would reset the list selection, |
50 // thereby disabling the apply button. | 52 // thereby disabling the apply button. |
51 event.preventDefault(); | 53 event.preventDefault(); |
52 }; | 54 }; |
53 | 55 |
(...skipping 14 matching lines...) Expand all Loading... |
68 options.system.bluetooth.BluetoothDeviceList.decorate(this.deviceList_); | 70 options.system.bluetooth.BluetoothDeviceList.decorate(this.deviceList_); |
69 this.deviceList_.autoExpands = true; | 71 this.deviceList_.autoExpands = true; |
70 } | 72 } |
71 }; | 73 }; |
72 | 74 |
73 // Export | 75 // Export |
74 return { | 76 return { |
75 BluetoothOptions: BluetoothOptions | 77 BluetoothOptions: BluetoothOptions |
76 }; | 78 }; |
77 }); | 79 }); |
OLD | NEW |