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

Unified Diff: chrome/browser/resources/cryptotoken/usbgnubbydevice.js

Issue 540693002: Only enumerate known WinUSB devices using chrome.usb, to avoid errors (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/cryptotoken/usbgnubbydevice.js
diff --git a/chrome/browser/resources/cryptotoken/usbgnubbydevice.js b/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
index 09b3909f91580a26157df46516f7ebcd6cd8868a..089ca1543ba3c67fbf643d82f4417459f5dd59d0 100644
--- a/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
+++ b/chrome/browser/resources/cryptotoken/usbgnubbydevice.js
@@ -374,26 +374,29 @@ UsbGnubbyDevice.prototype.queueCommand = function(cid, cmd, data) {
};
/**
+ * @const
+ */
+UsbGnubbyDevice.WINUSB_VID_PIDS = [
+ {'vendorId': 4176, 'productId': 529} // Yubico WinUSB
+];
+
+/**
* @param {function(Array)} cb Enumerate callback
*/
UsbGnubbyDevice.enumerate = function(cb) {
- var permittedDevs;
var numEnumerated = 0;
var allDevs = [];
function enumerated(devs) {
allDevs = allDevs.concat(devs);
- if (++numEnumerated == permittedDevs.length) {
+ if (++numEnumerated == UsbGnubbyDevice.WINUSB_VID_PIDS.length) {
cb(allDevs);
}
}
- GnubbyDevice.getPermittedUsbDevices(function(devs) {
- permittedDevs = devs;
- for (var i = 0; i < devs.length; i++) {
- chrome.usb.getDevices(devs[i], enumerated);
- }
- });
+ for (var i = 0; i < UsbGnubbyDevice.WINUSB_VID_PIDS.length; i++) {
+ chrome.usb.getDevices(UsbGnubbyDevice.WINUSB_VID_PIDS[i], enumerated);
+ }
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698