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 var deviceList = $('bluetooth-unpaired-devices-list'); |
83 options.system.bluetooth.BluetoothDeviceList.decorate(this.deviceList_); | 83 options.system.bluetooth.BluetoothDeviceList.decorate(deviceList); |
| 84 this.deviceList_ = assertInstanceof(deviceList, |
| 85 options.DeletableItemList); |
84 } | 86 } |
85 }; | 87 }; |
86 | 88 |
87 /** | 89 /** |
88 * Automatically start the device discovery process if the | 90 * Automatically start the device discovery process if the |
89 * "Add device" dialog is visible. | 91 * "Add device" dialog is visible. |
90 */ | 92 */ |
91 BluetoothOptions.startDeviceDiscovery = function() { | 93 BluetoothOptions.startDeviceDiscovery = function() { |
92 var page = BluetoothOptions.getInstance(); | 94 var page = BluetoothOptions.getInstance(); |
93 if (page && page.visible) | 95 if (page && page.visible) |
(...skipping 17 matching lines...) Expand all Loading... |
111 var page = BluetoothOptions.getInstance(); | 113 var page = BluetoothOptions.getInstance(); |
112 if (page && page.visible) | 114 if (page && page.visible) |
113 PageManager.closeOverlay(); | 115 PageManager.closeOverlay(); |
114 }; | 116 }; |
115 | 117 |
116 // Export | 118 // Export |
117 return { | 119 return { |
118 BluetoothOptions: BluetoothOptions | 120 BluetoothOptions: BluetoothOptions |
119 }; | 121 }; |
120 }); | 122 }); |
OLD | NEW |