| 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 */ var Page = cr.ui.pageManager.Page; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Encapsulated handling of the Bluetooth options page. | 10 * Encapsulated handling of the Bluetooth options page. |
| 11 * @constructor | 11 * @constructor |
| 12 * @extends {cr.ui.pageManager.Page} | 12 * @extends {cr.ui.pageManager.Page} |
| 13 */ | 13 */ |
| 14 function BluetoothOptions() { | 14 function BluetoothOptions() { |
| 15 Page.call(this, 'bluetooth', | 15 Page.call(this, 'bluetooth', |
| 16 loadTimeData.getString('bluetoothOptionsPageTabTitle'), | 16 loadTimeData.getString('bluetoothOptionsPageTabTitle'), |
| 17 'bluetooth-options'); | 17 'bluetooth-options'); |
| 18 } | 18 } |
| 19 | 19 |
| 20 cr.addSingletonGetter(BluetoothOptions); | 20 cr.addSingletonGetter(BluetoothOptions); |
| 21 | 21 |
| 22 BluetoothOptions.prototype = { | 22 BluetoothOptions.prototype = { |
| 23 __proto__: Page.prototype, | 23 __proto__: Page.prototype, |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * The list of available (unpaired) bluetooth devices. | 26 * The list of available (unpaired) bluetooth devices. |
| 27 * @type {DeletableItemList} | 27 * @type {options.DeletableItemList} |
| 28 * @private | 28 * @private |
| 29 */ | 29 */ |
| 30 deviceList_: null, | 30 deviceList_: null, |
| 31 | 31 |
| 32 /** @override */ | 32 /** @override */ |
| 33 initializePage: function() { | 33 initializePage: function() { |
| 34 Page.prototype.initializePage.call(this); | 34 Page.prototype.initializePage.call(this); |
| 35 this.createDeviceList_(); | 35 this.createDeviceList_(); |
| 36 | 36 |
| 37 BluetoothOptions.updateDiscoveryState(true); | 37 BluetoothOptions.updateDiscoveryState(true); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 /** @override */ | 72 /** @override */ |
| 73 didClosePage: function() { | 73 didClosePage: function() { |
| 74 chrome.send('stopBluetoothDeviceDiscovery'); | 74 chrome.send('stopBluetoothDeviceDiscovery'); |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Creates, decorates and initializes the bluetooth device list. | 78 * Creates, decorates and initializes the bluetooth device list. |
| 79 * @private | 79 * @private |
| 80 */ | 80 */ |
| 81 createDeviceList_: function() { | 81 createDeviceList_: function() { |
| 82 this.deviceList_ = $('bluetooth-unpaired-devices-list'); | 82 this.deviceList_ = assertInstanceof($('bluetooth-unpaired-devices-list'), |
| 83 options.DeletableItemList); |
| 83 options.system.bluetooth.BluetoothDeviceList.decorate(this.deviceList_); | 84 options.system.bluetooth.BluetoothDeviceList.decorate(this.deviceList_); |
| 84 } | 85 } |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 /** | 88 /** |
| 88 * Automatically start the device discovery process if the | 89 * Automatically start the device discovery process if the |
| 89 * "Add device" dialog is visible. | 90 * "Add device" dialog is visible. |
| 90 */ | 91 */ |
| 91 BluetoothOptions.startDeviceDiscovery = function() { | 92 BluetoothOptions.startDeviceDiscovery = function() { |
| 92 var page = BluetoothOptions.getInstance(); | 93 var page = BluetoothOptions.getInstance(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 var page = BluetoothOptions.getInstance(); | 112 var page = BluetoothOptions.getInstance(); |
| 112 if (page && page.visible) | 113 if (page && page.visible) |
| 113 PageManager.closeOverlay(); | 114 PageManager.closeOverlay(); |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 // Export | 117 // Export |
| 117 return { | 118 return { |
| 118 BluetoothOptions: BluetoothOptions | 119 BluetoothOptions: BluetoothOptions |
| 119 }; | 120 }; |
| 120 }); | 121 }); |
| OLD | NEW |