[sql] Remove _HAS_EXCEPTIONS=0 from build info.
[chromium-blink-merge.git] / chrome / browser / resources / chromeos / bluetooth_pair_device.js
blob7cba61d84a1f12caa573f9522beb7f778ca22933
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
3 // found in the LICENSE file.
5 var PageManager = cr.ui.pageManager.PageManager;
6 var BluetoothPairing = options.BluetoothPairing;
7 var FakeBluetoothOverlayParent = options.FakeBluetoothOverlayParent;
9 /** @override */
10 PageManager.closeOverlay = function() {
11 chrome.send('dialogClose');
14 /**
15 * Listener for the |beforeunload| event.
17 window.onbeforeunload = function() {
18 PageManager.willClose();
22 * Override calls from BluetoothOptionsHandler.
24 cr.define('options', function() {
25 function BluetoothOptions() {}
27 BluetoothOptions.startDeviceDiscovery = function() {};
28 BluetoothOptions.updateDiscoveryState = function() {};
29 BluetoothOptions.dismissOverlay = function() {
30 PageManager.closeOverlay();
33 return {
34 BluetoothOptions: BluetoothOptions
36 });
38 /**
39 * DOMContentLoaded handler, sets up the page.
41 function load() {
42 if (cr.isChromeOS)
43 document.documentElement.setAttribute('os', 'chromeos');
45 // Decorate the existing elements in the document.
46 cr.ui.decorate('input[pref][type=checkbox]', options.PrefCheckbox);
47 cr.ui.decorate('input[pref][type=number]', options.PrefNumber);
48 cr.ui.decorate('input[pref][type=radio]', options.PrefRadio);
49 cr.ui.decorate('input[pref][type=range]', options.PrefRange);
50 cr.ui.decorate('select[pref]', options.PrefSelect);
51 cr.ui.decorate('input[pref][type=text]', options.PrefTextField);
52 cr.ui.decorate('input[pref][type=url]', options.PrefTextField);
54 // TODO(ivankr): remove when http://crosbug.com/20660 is resolved.
55 var inputs = document.querySelectorAll('input[pref]');
56 for (var i = 0, el; el = inputs[i]; i++) {
57 el.addEventListener('keyup', function(e) {
58 cr.dispatchSimpleEvent(this, 'change');
59 });
62 chrome.send('coreOptionsInitialize');
64 PageManager.register(FakeBluetoothOverlayParent.getInstance());
65 PageManager.registerOverlay(BluetoothPairing.getInstance(),
66 FakeBluetoothOverlayParent.getInstance());
68 var device = {};
69 var args = JSON.parse(chrome.getVariableValue('dialogArguments'));
70 device = args;
71 device.pairing = 'bluetoothStartConnecting';
72 BluetoothPairing.showDialog(device);
73 chrome.send('updateBluetoothDevice', [device.address, 'connect']);
76 document.addEventListener('DOMContentLoaded', load);