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
3 // found in the LICENSE file.
6 * @fileoverview Contains a simple factory for creating and opening usbGnubby
12 * @param {Gnubbies} gnubbies Gnubbies singleton instance
14 * @implements {GnubbyFactory}
16 function UsbGnubbyFactory(gnubbies) {
17 /** @private {Gnubbies} */
18 this.gnubbies_ = gnubbies;
19 usbGnubby.setGnubbies(gnubbies);
23 * Creates a new gnubby object, and opens the gnubby with the given index.
24 * @param {llGnubbyDeviceId} which The device to open.
25 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling.
26 * @param {function(number, usbGnubby=)} cb Called with result of opening the
28 * @param {string=} logMsgUrl the url to post log messages to
31 UsbGnubbyFactory.prototype.openGnubby =
32 function(which, forEnroll, cb, logMsgUrl) {
33 var gnubby = new usbGnubby();
34 gnubby.open(which, function(rc) {
40 * Enumerates gnubbies.
41 * @param {function(number, Array.<llGnubbyDeviceId>)} cb Enumerate callback
43 UsbGnubbyFactory.prototype.enumerate = function(cb) {
44 this.gnubbies_.enumerate(cb);