| 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', |
| 64 'chrome/browser/ui/webui/usb_internals/usb_internals.mojom', | 65 'chrome/browser/ui/webui/usb_internals/usb_internals.mojom', |
| 65 'content/public/renderer/frame_interfaces', | 66 'content/public/renderer/frame_interfaces', |
| 66 ]).then(function(modules) { | 67 ]).then(function(modules) { |
| 67 let mojom = modules[0]; | 68 let connection = modules[0]; |
| 68 let frameInterfaces = modules[1]; | 69 let mojom = modules[1]; |
| 70 let frameInterfaces = modules[2]; |
| 69 | 71 |
| 70 pageHandler = new mojom.UsbInternalsPageHandlerPtr( | 72 pageHandler = connection.bindHandleToProxy( |
| 71 frameInterfaces.getInterface(mojom.UsbInternalsPageHandler.name)); | 73 frameInterfaces.getInterface(mojom.UsbInternalsPageHandler.name), |
| 74 mojom.UsbInternalsPageHandler); |
| 72 }); | 75 }); |
| 73 } | 76 } |
| 74 | 77 |
| 75 document.addEventListener('DOMContentLoaded', function() { | 78 document.addEventListener('DOMContentLoaded', function() { |
| 76 initializeProxies().then(function() { | 79 initializeProxies().then(function() { |
| 77 $('add-test-device-form').addEventListener('submit', addTestDevice); | 80 $('add-test-device-form').addEventListener('submit', addTestDevice); |
| 78 refreshDeviceList(); | 81 refreshDeviceList(); |
| 79 }); | 82 }); |
| 80 }); | 83 }); |
| 81 })(); | 84 })(); |
| OLD | NEW |