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

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: 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 };
kevers 2012/03/13 22:57:20 missing closeOverlay on the reject click?
keybuk 2012/03/13 22:59:43 Done.
84 $('bluetooth-pair-device-connect-button').onclick = function() {
81 var args = [self.device_.address, 'connect']; 85 var args = [self.device_.address, 'connect'];
82 var passkey = self.device_.passkey; 86 var passkey = self.device_.passkey;
83 if (!passkey && !$('bluetooth-pairing-passkey-entry').hidden) 87 if (!passkey && !$('bluetooth-pairing-passkey-entry').hidden)
84 passkey = $('bluetooth-passkey').value; 88 passkey = $('bluetooth-passkey').value;
85 if (passkey) 89 if (passkey)
86 args.push(String(passkey)); 90 args.push(String(passkey));
87 chrome.send('updateBluetoothDevice', args); 91 chrome.send('updateBluetoothDevice', args);
88 OptionsPage.closeOverlay(); 92 OptionsPage.closeOverlay();
89 }; 93 };
90 $('bluetooth-pair-device-cancel-button').onclick = cancel; 94 $('bluetooth-pair-device-accept-button').onclick = function() {
91 $('bluetooth-pair-device-reject-button').onclick = cancel; 95 chrome.send('updateBluetoothDevice',
92 $('bluetooth-pair-device-connect-button').onclick = connect; 96 [self.device_.address, 'accept']);
93 $('bluetooth-pair-device-accept-button').onclick = connect; 97 OptionsPage.closeOverlay();
98 };
94 $('bluetooth-pair-device-dismiss-button').onclick = function() { 99 $('bluetooth-pair-device-dismiss-button').onclick = function() {
95 OptionsPage.closeOverlay(); 100 OptionsPage.closeOverlay();
96 }; 101 };
97 $('bluetooth-passkey').oninput = function() { 102 $('bluetooth-passkey').oninput = function() {
98 $('bluetooth-pair-device-connect-button').disabled = 103 $('bluetooth-pair-device-connect-button').disabled =
99 $('bluetooth-passkey').value.length == 0; 104 $('bluetooth-passkey').value.length == 0;
100 } 105 }
101 }, 106 },
102 107
103 /** 108 /**
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 BluetoothPairing.showDialog = function(device) { 264 BluetoothPairing.showDialog = function(device) {
260 BluetoothPairing.getInstance().update(device); 265 BluetoothPairing.getInstance().update(device);
261 OptionsPage.navigateToPage('bluetoothPairing'); 266 OptionsPage.navigateToPage('bluetoothPairing');
262 }; 267 };
263 268
264 // Export 269 // Export
265 return { 270 return {
266 BluetoothPairing: BluetoothPairing 271 BluetoothPairing: BluetoothPairing
267 }; 272 };
268 }); 273 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698