OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 var OptionsPage = options.OptionsPage; | 5 var PageManager = cr.ui.pageManager.PageManager; |
6 var BluetoothPairing = options.BluetoothPairing; | 6 var BluetoothPairing = options.BluetoothPairing; |
7 var FakeBluetoothOverlayParent = options.FakeBluetoothOverlayParent; | 7 var FakeBluetoothOverlayParent = options.FakeBluetoothOverlayParent; |
8 | 8 |
9 /** @override */ | 9 /** @override */ |
10 OptionsPage.closeOverlay = function() { | 10 PageManager.closeOverlay = function() { |
11 chrome.send('dialogClose'); | 11 chrome.send('dialogClose'); |
12 }; | 12 }; |
13 | 13 |
14 /** | 14 /** |
15 * Listener for the |beforeunload| event. | 15 * Listener for the |beforeunload| event. |
16 */ | 16 */ |
17 window.onbeforeunload = function() { | 17 window.onbeforeunload = function() { |
18 OptionsPage.willClose(); | 18 PageManager.willClose(); |
19 }; | 19 }; |
20 | 20 |
21 /** | 21 /** |
22 * DOMContentLoaded handler, sets up the page. | 22 * DOMContentLoaded handler, sets up the page. |
23 */ | 23 */ |
24 function load() { | 24 function load() { |
25 if (cr.isChromeOS) | 25 if (cr.isChromeOS) |
26 document.documentElement.setAttribute('os', 'chromeos'); | 26 document.documentElement.setAttribute('os', 'chromeos'); |
27 | 27 |
28 // Decorate the existing elements in the document. | 28 // Decorate the existing elements in the document. |
29 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox); | 29 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox); |
30 cr.ui.decorate('input[pref][type=number]', options.PrefNumber); | 30 cr.ui.decorate('input[pref][type=number]', options.PrefNumber); |
31 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio); | 31 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio); |
32 cr.ui.decorate('input[pref][type=range]', options.PrefRange); | 32 cr.ui.decorate('input[pref][type=range]', options.PrefRange); |
33 cr.ui.decorate('select[pref]', options.PrefSelect); | 33 cr.ui.decorate('select[pref]', options.PrefSelect); |
34 cr.ui.decorate('input[pref][type=text]', options.PrefTextField); | 34 cr.ui.decorate('input[pref][type=text]', options.PrefTextField); |
35 cr.ui.decorate('input[pref][type=url]', options.PrefTextField); | 35 cr.ui.decorate('input[pref][type=url]', options.PrefTextField); |
36 | 36 |
37 // TODO(ivankr): remove when http://crosbug.com/20660 is resolved. | 37 // TODO(ivankr): remove when http://crosbug.com/20660 is resolved. |
38 var inputs = document.querySelectorAll('input[pref]'); | 38 var inputs = document.querySelectorAll('input[pref]'); |
39 for (var i = 0, el; el = inputs[i]; i++) { | 39 for (var i = 0, el; el = inputs[i]; i++) { |
40 el.addEventListener('keyup', function(e) { | 40 el.addEventListener('keyup', function(e) { |
41 cr.dispatchSimpleEvent(this, 'change'); | 41 cr.dispatchSimpleEvent(this, 'change'); |
42 }); | 42 }); |
43 } | 43 } |
44 | 44 |
45 chrome.send('coreOptionsInitialize'); | 45 chrome.send('coreOptionsInitialize'); |
46 | 46 |
47 OptionsPage.register(FakeBluetoothOverlayParent.getInstance()); | 47 PageManager.register(FakeBluetoothOverlayParent.getInstance()); |
48 OptionsPage.registerOverlay(BluetoothPairing.getInstance(), | 48 PageManager.registerOverlay(BluetoothPairing.getInstance(), |
49 FakeBluetoothOverlayParent.getInstance()); | 49 FakeBluetoothOverlayParent.getInstance()); |
50 | 50 |
51 var device = {}; | 51 var device = {}; |
52 var args = JSON.parse(chrome.getVariableValue('dialogArguments')); | 52 var args = JSON.parse(chrome.getVariableValue('dialogArguments')); |
53 device = args; | 53 device = args; |
54 device.pairing = 'bluetoothStartConnecting'; | 54 device.pairing = 'bluetoothStartConnecting'; |
55 BluetoothPairing.showDialog(device); | 55 BluetoothPairing.showDialog(device); |
56 chrome.send('updateBluetoothDevice', [device.address, 'connect']); | 56 chrome.send('updateBluetoothDevice', [device.address, 'connect']); |
57 } | 57 } |
58 | 58 |
59 document.addEventListener('DOMContentLoaded', load); | 59 document.addEventListener('DOMContentLoaded', load); |
OLD | NEW |