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 usb_internals.html, served from chrome://usb-internals/. | 6 * Javascript for usb_internals.html, served from chrome://usb-internals/. |
7 */ | 7 */ |
8 | 8 |
9 (function() { | 9 (function() { |
10 // Connection to the UsbInternalsPageHandler instance running in the browser | 10 // Connection to the UsbInternalsPageHandler instance running in the browser |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 refreshDeviceList(); | 54 refreshDeviceList(); |
55 $('add-test-device-result').textContent = response.message; | 55 $('add-test-device-result').textContent = response.message; |
56 $('add-test-device-result').className = | 56 $('add-test-device-result').className = |
57 response.success ? 'action-success' : 'action-failure'; | 57 response.success ? 'action-success' : 'action-failure'; |
58 }); | 58 }); |
59 event.preventDefault(); | 59 event.preventDefault(); |
60 } | 60 } |
61 | 61 |
62 function initializeProxies() { | 62 function initializeProxies() { |
63 return importModules([ | 63 return importModules([ |
64 'mojo/public/js/connection', | |
65 'chrome/browser/ui/webui/usb_internals/usb_internals.mojom', | 64 'chrome/browser/ui/webui/usb_internals/usb_internals.mojom', |
66 'content/public/renderer/frame_interfaces', | 65 'content/public/renderer/frame_interfaces', |
67 ]).then(function(modules) { | 66 ]).then(function(modules) { |
68 let connection = modules[0]; | 67 let mojom = modules[0]; |
69 let mojom = modules[1]; | 68 let frameInterfaces = modules[1]; |
70 let frameInterfaces = modules[2]; | |
71 | 69 |
72 pageHandler = connection.bindHandleToProxy( | 70 pageHandler = new mojom.UsbInternalsPageHandlerPtr( |
73 frameInterfaces.getInterface(mojom.UsbInternalsPageHandler.name), | 71 frameInterfaces.getInterface(mojom.UsbInternalsPageHandler.name)); |
74 mojom.UsbInternalsPageHandler); | |
75 }); | 72 }); |
76 } | 73 } |
77 | 74 |
78 document.addEventListener('DOMContentLoaded', function() { | 75 document.addEventListener('DOMContentLoaded', function() { |
79 initializeProxies().then(function() { | 76 initializeProxies().then(function() { |
80 $('add-test-device-form').addEventListener('submit', addTestDevice); | 77 $('add-test-device-form').addEventListener('submit', addTestDevice); |
81 refreshDeviceList(); | 78 refreshDeviceList(); |
82 }); | 79 }); |
83 }); | 80 }); |
84 })(); | 81 })(); |
OLD | NEW |