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/bluetooth_internals/interfaces.js

Issue 2446823002: bluetooth: Componentize device list in chrome://bluetooth-internals. (Closed)
Patch Set: Formatting changes, comments Created 4 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2016 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.
4
5 /**
6 * Javascript for Mojo interface helpers, served from
7 * chrome://bluetooth-internals/.
8 */
9
10 cr.define('interfaces', function() {
11 /**
12 * Initializes Mojo proxies for page and Bluetooth services.
ortuno 2016/11/03 22:14:15 Also mention that the interfaces are added to the
mbrunson 2016/11/03 23:59:40 Done.
13 * @return {!Promise<interfaces.BluetoothAdapter.Adapter>} resolves with
14 * Adapter if acquired, rejects if Bluetooth is not supported.
15 */
16 function initializeProxies() {
17 return importModules([
18 'content/public/renderer/frame_interfaces',
19 'device/bluetooth/public/interfaces/adapter.mojom',
20 'device/bluetooth/public/interfaces/device.mojom',
21 'mojo/public/js/connection',
22 ]).then(function([frameInterfaces, bluetoothAdapter, bluetoothDevice,
23 connection]) {
24 Object.assign(interfaces, {
25 BluetoothAdapter: bluetoothAdapter,
26 BluetoothDevice: bluetoothDevice,
27 Connection: connection,
28 });
29
30 var adapterFactory = connection.bindHandleToProxy(
ortuno 2016/11/03 22:14:15 Could you move the adapter code to the broker?
mbrunson 2016/11/03 23:59:40 Done.
31 frameInterfaces.getInterface(bluetoothAdapter.AdapterFactory.name),
32 bluetoothAdapter.AdapterFactory);
33
34 // Get an Adapter service.
35 return adapterFactory.getAdapter();
36 }).then(function(response) {
37 if (!response.adapter) {
38 throw new Error('Bluetooth Not Supported on this platform.');
39 }
40
41 return interfaces.Connection.bindHandleToProxy(
42 response.adapter,
43 interfaces.BluetoothAdapter.Adapter);
44 });
45 }
46
47 return {
48 initialize: initializeProxies,
49 };
50 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698