Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/resources/options/chromeos/bluetooth_add_device_overlay.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh just no Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 OptionsPage = options.OptionsPage; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
7 8
8 /** 9 /**
9 * Encapsulated handling of the Bluetooth options page. 10 * Encapsulated handling of the Bluetooth options page.
10 * @constructor 11 * @constructor
11 */ 12 */
12 function BluetoothOptions() { 13 function BluetoothOptions() {
13 OptionsPage.call(this, 14 Page.call(this, 'bluetooth',
14 'bluetooth', 15 loadTimeData.getString('bluetoothOptionsPageTabTitle'),
15 loadTimeData.getString('bluetoothOptionsPageTabTitle'), 16 'bluetooth-options');
16 'bluetooth-options');
17 } 17 }
18 18
19 cr.addSingletonGetter(BluetoothOptions); 19 cr.addSingletonGetter(BluetoothOptions);
20 20
21 BluetoothOptions.prototype = { 21 BluetoothOptions.prototype = {
22 __proto__: OptionsPage.prototype, 22 __proto__: Page.prototype,
23 23
24 /** 24 /**
25 * The list of available (unpaired) bluetooth devices. 25 * The list of available (unpaired) bluetooth devices.
26 * @type {DeletableItemList} 26 * @type {DeletableItemList}
27 * @private 27 * @private
28 */ 28 */
29 deviceList_: null, 29 deviceList_: null,
30 30
31 /** @override */ 31 /** @override */
32 initializePage: function() { 32 initializePage: function() {
33 OptionsPage.prototype.initializePage.call(this); 33 Page.prototype.initializePage.call(this);
34 this.createDeviceList_(); 34 this.createDeviceList_();
35 35
36 BluetoothOptions.updateDiscoveryState(true); 36 BluetoothOptions.updateDiscoveryState(true);
37 37
38 $('bluetooth-add-device-cancel-button').onclick = function(event) { 38 $('bluetooth-add-device-cancel-button').onclick = function(event) {
39 OptionsPage.closeOverlay(); 39 PageManager.closeOverlay();
40 }; 40 };
41 41
42 var self = this; 42 var self = this;
43 $('bluetooth-add-device-apply-button').onclick = function(event) { 43 $('bluetooth-add-device-apply-button').onclick = function(event) {
44 var device = self.deviceList_.selectedItem; 44 var device = self.deviceList_.selectedItem;
45 var address = device.address; 45 var address = device.address;
46 OptionsPage.closeOverlay(); 46 PageManager.closeOverlay();
47 device.pairing = 'bluetoothStartConnecting'; 47 device.pairing = 'bluetoothStartConnecting';
48 options.BluetoothPairing.showDialog(device); 48 options.BluetoothPairing.showDialog(device);
49 chrome.send('updateBluetoothDevice', [address, 'connect']); 49 chrome.send('updateBluetoothDevice', [address, 'connect']);
50 }; 50 };
51 51
52 $('bluetooth-unpaired-devices-list').addEventListener('change', 52 $('bluetooth-unpaired-devices-list').addEventListener('change',
53 function() { 53 function() {
54 var item = $('bluetooth-unpaired-devices-list').selectedItem; 54 var item = $('bluetooth-unpaired-devices-list').selectedItem;
55 // The "bluetooth-add-device-apply-button" should be enabled for devices 55 // The "bluetooth-add-device-apply-button" should be enabled for devices
56 // that can be paired or remembered. Devices not supporting pairing will 56 // that can be paired or remembered. Devices not supporting pairing will
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 $('bluetooth-scanning-icon').hidden = !discovering; 102 $('bluetooth-scanning-icon').hidden = !discovering;
103 $('bluetooth-scan-stopped-label').hidden = discovering; 103 $('bluetooth-scan-stopped-label').hidden = discovering;
104 }; 104 };
105 105
106 /** 106 /**
107 * If the "Add device" dialog is visible, dismiss it. 107 * If the "Add device" dialog is visible, dismiss it.
108 */ 108 */
109 BluetoothOptions.dismissOverlay = function() { 109 BluetoothOptions.dismissOverlay = function() {
110 var page = BluetoothOptions.getInstance(); 110 var page = BluetoothOptions.getInstance();
111 if (page && page.visible) 111 if (page && page.visible)
112 OptionsPage.closeOverlay(); 112 PageManager.closeOverlay();
113 }; 113 };
114 114
115 // Export 115 // Export
116 return { 116 return {
117 BluetoothOptions: BluetoothOptions 117 BluetoothOptions: BluetoothOptions
118 }; 118 };
119 }); 119 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698