| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
| 6 * Javascript for Mojo interface helpers, served from | 6 * Javascript for Mojo interface helpers, served from |
| 7 * chrome://bluetooth-internals/. | 7 * chrome://bluetooth-internals/. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 cr.define('interfaces', function() { | 10 cr.define('interfaces', function() { |
| 11 /** | 11 /** |
| 12 * Imports Mojo interfaces and adds them to window.interfaces. | 12 * Sets up Mojo interfaces and adds them to window.interfaces. |
| 13 * @return {Promise} | 13 * @return {Promise} |
| 14 */ | 14 */ |
| 15 function importInterfaces() { | 15 function setupInterfaces() { |
| 16 return importModules([ | 16 return importModules([ |
| 17 'content/public/renderer/frame_interfaces', | 17 'content/public/renderer/frame_interfaces', |
| 18 'device/bluetooth/public/interfaces/adapter.mojom', | 18 'device/bluetooth/public/interfaces/adapter.mojom', |
| 19 'device/bluetooth/public/interfaces/device.mojom', | 19 'device/bluetooth/public/interfaces/device.mojom', |
| 20 'mojo/public/js/connection', | 20 'mojo/public/js/connection', |
| 21 ]).then(function([frameInterfaces, bluetoothAdapter, bluetoothDevice, | 21 ]).then(function([frameInterfaces, bluetoothAdapter, bluetoothDevice, |
| 22 connection]) { | 22 connection]) { |
| 23 Object.assign(interfaces, { | 23 interfaces.BluetoothAdapter = bluetoothAdapter; |
| 24 BluetoothAdapter: bluetoothAdapter, | 24 interfaces.BluetoothDevice = bluetoothDevice; |
| 25 BluetoothDevice: bluetoothDevice, | 25 interfaces.Connection = connection; |
| 26 Connection: connection, | 26 interfaces.FrameInterfaces = frameInterfaces; |
| 27 FrameInterfaces: frameInterfaces, | |
| 28 }); | |
| 29 }); | 27 }); |
| 30 } | 28 } |
| 31 | 29 |
| 32 return { | 30 return { |
| 33 BluetoothAdapter: {}, | 31 setupInterfaces: setupInterfaces, |
| 34 BluetoothDevice: {}, | |
| 35 Connection: {}, | |
| 36 FrameInterfaces: {}, | |
| 37 importInterfaces: importInterfaces, | |
| 38 }; | 32 }; |
| 39 }); | 33 }); |
| OLD | NEW |