diff options
Diffstat (limited to 'chrome/browser/resources/cryptotoken/gnubby.js')
-rw-r--r-- | chrome/browser/resources/cryptotoken/gnubby.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/resources/cryptotoken/gnubby.js b/chrome/browser/resources/cryptotoken/gnubby.js index b283ee9..197f9fb 100644 --- a/chrome/browser/resources/cryptotoken/gnubby.js +++ b/chrome/browser/resources/cryptotoken/gnubby.js @@ -57,20 +57,33 @@ Gnubby.hexCid = function(cid) { }; /** + * Cancels open attempt for this gnubby, if available. + */ +Gnubby.prototype.cancelOpen = function() { + if (this.which) + Gnubby.gnubbies_.cancelAddClient(this.which); +}; + +/** * Opens the gnubby with the given index, or the first found gnubby if no * index is specified. * @param {GnubbyDeviceId} which The device to open. If null, the first * gnubby found is opened. + * @param {GnubbyEnumerationTypes=} opt_type Which type of device to enumerate. * @param {function(number)|undefined} opt_cb Called with result of opening the * gnubby. + * @param {string=} opt_caller Identifier for the caller. */ -Gnubby.prototype.open = function(which, opt_cb) { +Gnubby.prototype.open = function(which, opt_type, opt_cb, opt_caller) { var cb = opt_cb ? opt_cb : Gnubby.defaultCallback; if (this.closed) { cb(-GnubbyDevice.NODEVICE); return; } this.closingWhenIdle = false; + if (opt_caller) { + this.caller_ = opt_caller; + } var self = this; @@ -94,7 +107,7 @@ Gnubby.prototype.open = function(which, opt_cb) { if (rc == -GnubbyDevice.NODEVICE && enumerateRetriesRemaining-- > 0) { // We were trying to open the first device, but now it's not there? // Do over. - Gnubby.gnubbies_.enumerate(enumerated); + Gnubby.gnubbies_.enumerate(enumerated, opt_type); return; } self.dev = device; @@ -110,7 +123,7 @@ Gnubby.prototype.open = function(which, opt_cb) { cb(rc); }); } else { - Gnubby.gnubbies_.enumerate(enumerated); + Gnubby.gnubbies_.enumerate(enumerated, opt_type); } }; |