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

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

Issue 249913002: FIDO U2F component extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with HEAD Created 6 years, 8 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
Index: chrome/browser/resources/cryptotoken/usbgnubbyfactory.js
diff --git a/chrome/browser/resources/cryptotoken/usbgnubbyfactory.js b/chrome/browser/resources/cryptotoken/usbgnubbyfactory.js
new file mode 100644
index 0000000000000000000000000000000000000000..17c8121b9269b9aa2842daa2c146593eef780d2c
--- /dev/null
+++ b/chrome/browser/resources/cryptotoken/usbgnubbyfactory.js
@@ -0,0 +1,46 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Contains a simple factory for creating and opening usbGnubby
+ * instances.
+ * @author juanlang@google.com (Juan Lang)
+ */
+'use strict';
+
+/**
+ * @param {Gnubbies} gnubbies
+ * @constructor
+ * @implements {GnubbyFactory}
+ */
+function UsbGnubbyFactory(gnubbies) {
+ /** @private {Gnubbies} */
+ this.gnubbies_ = gnubbies;
+ usbGnubby.setGnubbies(gnubbies);
+}
+
+/**
+ * Creates a new gnubby object, and opens the gnubby with the given index.
+ * @param {llGnubbyDeviceId} which The device to open.
+ * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling.
+ * @param {function(number, usbGnubby=)} cb Called with result of opening the
+ * gnubby.
+ * @param {string=} logMsgUrl the url to post log messages to
+ * @override
+ */
+UsbGnubbyFactory.prototype.openGnubby =
+ function(which, forEnroll, cb, logMsgUrl) {
+ var gnubby = new usbGnubby();
+ gnubby.open(which, function(rc) {
+ cb(rc, gnubby);
+ });
+};
+
+/**
+ * Enumerates gnubbies.
+ * @param {function(number, Array.<llGnubbyDeviceId>)} cb
+ */
+UsbGnubbyFactory.prototype.enumerate = function(cb) {
+ this.gnubbies_.enumerate(cb);
+};
« no previous file with comments | « chrome/browser/resources/cryptotoken/usbenrollhelper.js ('k') | chrome/browser/resources/cryptotoken/usbsignhelper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698