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

Side by Side Diff: extensions/renderer/resources/serial_service.js

Issue 562563002: Make some fields non-nullable in serial.mojom and data_stream.mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « extensions/renderer/api/serial/serial_api_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « extensions/renderer/api/serial/serial_api_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698