| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 define('serial_service', [ | 5 define('serial_service', [ |
| 6 'content/public/renderer/service_provider', | 6 'content/public/renderer/service_provider', |
| 7 'data_receiver', | 7 'data_receiver', |
| 8 'data_sender', | 8 'data_sender', |
| 9 'device/serial/serial.mojom', | 9 'device/serial/serial.mojom', |
| 10 'mojo/public/js/bindings/core', | 10 'mojo/public/js/bindings/core', |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * converts parameters and result between the Apps serial API types and the | 23 * converts parameters and result between the Apps serial API types and the |
| 24 * Mojo types. | 24 * Mojo types. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 var service = new serialMojom.SerialServiceProxy(new routerModule.Router( | 27 var service = new serialMojom.SerialServiceProxy(new routerModule.Router( |
| 28 serviceProvider.connectToService(serialMojom.SerialServiceProxy.NAME_))); | 28 serviceProvider.connectToService(serialMojom.SerialServiceProxy.NAME_))); |
| 29 | 29 |
| 30 function getDevices() { | 30 function getDevices() { |
| 31 return service.getDevices().then(function(response) { | 31 return service.getDevices().then(function(response) { |
| 32 return $Array.map(response.devices, function(device) { | 32 return $Array.map(response.devices, function(device) { |
| 33 var result = {path: device.path || ''}; | 33 var result = {path: device.path}; |
| 34 if (device.has_vendor_id) | 34 if (device.has_vendor_id) |
| 35 result.vendorId = device.vendor_id; | 35 result.vendorId = device.vendor_id; |
| 36 if (device.has_product_id) | 36 if (device.has_product_id) |
| 37 result.productId = device.product_id; | 37 result.productId = device.product_id; |
| 38 if (device.display_name) | 38 if (device.display_name) |
| 39 result.displayName = device.display_name; | 39 result.displayName = device.display_name; |
| 40 return result; | 40 return result; |
| 41 }); | 41 }); |
| 42 }); | 42 }); |
| 43 } | 43 } |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 417 |
| 418 return { | 418 return { |
| 419 getDevices: getDevices, | 419 getDevices: getDevices, |
| 420 createConnection: Connection.create, | 420 createConnection: Connection.create, |
| 421 getConnection: getConnection, | 421 getConnection: getConnection, |
| 422 getConnections: getConnections, | 422 getConnections: getConnections, |
| 423 // For testing. | 423 // For testing. |
| 424 Connection: Connection, | 424 Connection: Connection, |
| 425 }; | 425 }; |
| 426 }); | 426 }); |
| OLD | NEW |