Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / browser / resources / cryptotoken / gnubbyfactory.js
blob494602b9a2368145f04658aa232d336abec7ce6d
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.
5 /**
6 * @fileoverview Contains a factory interface for creating and opening gnubbies.
7 */
8 'use strict';
10 /**
11 * A factory for creating and opening gnubbies.
12 * @interface
14 function GnubbyFactory() {}
16 /**
17 * Enumerates gnubbies.
18 * @param {function(number, Array.<GnubbyDeviceId>)} cb Enumerate callback
20 GnubbyFactory.prototype.enumerate = function(cb) {
23 /** @typedef {function(number, Gnubby=)} */
24 var FactoryOpenCallback;
26 /**
27 * Creates a new gnubby object, and opens the gnubby with the given index.
28 * @param {GnubbyDeviceId} which The device to open.
29 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling.
30 * @param {FactoryOpenCallback} cb Called with result of opening the gnubby.
31 * @param {string=} logMsgUrl the url to post log messages to
33 GnubbyFactory.prototype.openGnubby = function(which, forEnroll, cb, logMsgUrl) {
36 /**
37 * Called during enrollment to check whether a gnubby known not to be enrolled
38 * is allowed to enroll in its present state. Upon completion of the check, the
39 * callback is called.
40 * @param {Gnubby} gnubby The not-enrolled gnubby.
41 * @param {string} appIdHash The base64-encoded hash of the app id for which
42 * the gnubby being enrolled.
43 * @param {FactoryOpenCallback} cb Called with the result of the prerequisite
44 * check. (A non-zero status indicates failure.)
46 GnubbyFactory.prototype.notEnrolledPrerequisiteCheck =
47 function(gnubby, appIdHash, cb) {