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

Side by Side Diff: chrome/browser/resources/options2/chromeos/bluetooth_pair_device_overlay.js

Issue 9694054: bluetooth: implement device pairing support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: [clang] use POD for constants to avoid exit-time destructor error Created 8 years, 9 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 OptionsPage = options.OptionsPage;
7 7
8 /** 8 /**
9 * Enumeration of possible states during pairing. The value associated with 9 * Enumeration of possible states during pairing. The value associated with
10 * each state maps to a localized string in the global variable 10 * each state maps to a localized string in the global variable
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 * pincode: string|undefined, 65 * pincode: string|undefined,
66 * entered: number|undefined}} 66 * entered: number|undefined}}
67 * @private. 67 * @private.
68 */ 68 */
69 device_: null, 69 device_: null,
70 70
71 /** @inheritDoc */ 71 /** @inheritDoc */
72 initializePage: function() { 72 initializePage: function() {
73 OptionsPage.prototype.initializePage.call(this); 73 OptionsPage.prototype.initializePage.call(this);
74 var self = this; 74 var self = this;
75 var cancel = function() { 75 $('bluetooth-pair-device-cancel-button').onclick = function() {
76 chrome.send('updateBluetoothDevice', 76 chrome.send('updateBluetoothDevice',
77 [self.device_.address, 'cancel']); 77 [self.device_.address, 'cancel']);
78 OptionsPage.closeOverlay(); 78 OptionsPage.closeOverlay();
79 }; 79 };
80 var connect = function() { 80 $('bluetooth-pair-device-reject-button').onclick = function() {
81 chrome.send('updateBluetoothDevice',
82 [self.device_.address, 'reject']);
83 OptionsPage.closeOverlay();
84 };
85 $('bluetooth-pair-device-connect-button').onclick = function() {
81 var args = [self.device_.address, 'connect']; 86 var args = [self.device_.address, 'connect'];
82 var passkey = self.device_.passkey; 87 var passkey = self.device_.passkey;
83 if (!passkey && !$('bluetooth-pairing-passkey-entry').hidden) 88 if (!passkey && !$('bluetooth-pairing-passkey-entry').hidden)
84 passkey = $('bluetooth-passkey').value; 89 passkey = $('bluetooth-passkey').value;
85 if (passkey) 90 if (passkey)
86 args.push(String(passkey)); 91 args.push(String(passkey));
87 chrome.send('updateBluetoothDevice', args); 92 chrome.send('updateBluetoothDevice', args);
88 OptionsPage.closeOverlay(); 93 OptionsPage.closeOverlay();
89 }; 94 };
90 $('bluetooth-pair-device-cancel-button').onclick = cancel; 95 $('bluetooth-pair-device-accept-button').onclick = function() {
91 $('bluetooth-pair-device-reject-button').onclick = cancel; 96 chrome.send('updateBluetoothDevice',
92 $('bluetooth-pair-device-connect-button').onclick = connect; 97 [self.device_.address, 'accept']);
93 $('bluetooth-pair-device-accept-button').onclick = connect; 98 OptionsPage.closeOverlay();
99 };
94 $('bluetooth-pair-device-dismiss-button').onclick = function() { 100 $('bluetooth-pair-device-dismiss-button').onclick = function() {
95 OptionsPage.closeOverlay(); 101 OptionsPage.closeOverlay();
96 }; 102 };
97 $('bluetooth-passkey').oninput = function() { 103 $('bluetooth-passkey').oninput = function() {
98 $('bluetooth-pair-device-connect-button').disabled = 104 $('bluetooth-pair-device-connect-button').disabled =
99 $('bluetooth-passkey').value.length == 0; 105 $('bluetooth-passkey').value.length == 0;
100 } 106 }
101 }, 107 },
102 108
103 /** 109 /**
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 BluetoothPairing.showDialog = function(device) { 265 BluetoothPairing.showDialog = function(device) {
260 BluetoothPairing.getInstance().update(device); 266 BluetoothPairing.getInstance().update(device);
261 OptionsPage.navigateToPage('bluetoothPairing'); 267 OptionsPage.navigateToPage('bluetoothPairing');
262 }; 268 };
263 269
264 // Export 270 // Export
265 return { 271 return {
266 BluetoothPairing: BluetoothPairing 272 BluetoothPairing: BluetoothPairing
267 }; 273 };
268 }); 274 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698