| 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 /** | 5 /** |
| 6 * @fileoverview Implements a low-level gnubby driver based on chrome.hid. | 6 * @fileoverview Implements a low-level gnubby driver based on chrome.hid. |
| 7 */ | 7 */ |
| 8 'use strict'; | 8 'use strict'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 if (chrome.runtime.lastError) { | 396 if (chrome.runtime.lastError) { |
| 397 console.log(UTIL_fmt('send got lastError:')); | 397 console.log(UTIL_fmt('send got lastError:')); |
| 398 console.log(UTIL_fmt(chrome.runtime.lastError.message)); | 398 console.log(UTIL_fmt(chrome.runtime.lastError.message)); |
| 399 window.setTimeout(function() { self.destroy(); }, 0); | 399 window.setTimeout(function() { self.destroy(); }, 0); |
| 400 return; | 400 return; |
| 401 } | 401 } |
| 402 self.txqueue.shift(); // drop sent frame from queue. | 402 self.txqueue.shift(); // drop sent frame from queue. |
| 403 if (self.txqueue.length != 0) { | 403 if (self.txqueue.length != 0) { |
| 404 window.setTimeout(function() { self.writePump_(); }, 0); | 404 window.setTimeout(function() { self.writePump_(); }, 0); |
| 405 } | 405 } |
| 406 }; | 406 } |
| 407 | 407 |
| 408 var u8 = new Uint8Array(frame); | 408 var u8 = new Uint8Array(frame); |
| 409 | 409 |
| 410 // See whether this requires scrubbing before logging. | 410 // See whether this requires scrubbing before logging. |
| 411 var alternateLog = Gnubby.hasOwnProperty('redactRequestLog') && | 411 var alternateLog = Gnubby.hasOwnProperty('redactRequestLog') && |
| 412 Gnubby['redactRequestLog'](u8); | 412 Gnubby['redactRequestLog'](u8); |
| 413 if (alternateLog) { | 413 if (alternateLog) { |
| 414 console.log(UTIL_fmt('>' + alternateLog)); | 414 console.log(UTIL_fmt('>' + alternateLog)); |
| 415 } else { | 415 } else { |
| 416 console.log(UTIL_fmt('>' + UTIL_BytesToHex(u8))); | 416 console.log(UTIL_fmt('>' + UTIL_BytesToHex(u8))); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 */ | 545 */ |
| 546 HidGnubbyDevice.register = function(gnubbies) { | 546 HidGnubbyDevice.register = function(gnubbies) { |
| 547 var HID_GNUBBY_IMPL = { | 547 var HID_GNUBBY_IMPL = { |
| 548 isSharedAccess: true, | 548 isSharedAccess: true, |
| 549 enumerate: HidGnubbyDevice.enumerate, | 549 enumerate: HidGnubbyDevice.enumerate, |
| 550 deviceToDeviceId: HidGnubbyDevice.deviceToDeviceId, | 550 deviceToDeviceId: HidGnubbyDevice.deviceToDeviceId, |
| 551 open: HidGnubbyDevice.open | 551 open: HidGnubbyDevice.open |
| 552 }; | 552 }; |
| 553 gnubbies.registerNamespace(HidGnubbyDevice.NAMESPACE, HID_GNUBBY_IMPL); | 553 gnubbies.registerNamespace(HidGnubbyDevice.NAMESPACE, HID_GNUBBY_IMPL); |
| 554 }; | 554 }; |
| OLD | NEW |