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

Side by Side Diff: chrome/browser/resources/cryptotoken/usbgnubbyfactory.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Contains a simple factory for creating and opening Gnubby 6 * @fileoverview Contains a simple factory for creating and opening Gnubby
7 * instances. 7 * instances.
8 */ 8 */
9 'use strict'; 9 'use strict';
10 10
(...skipping 13 matching lines...) Expand all
24 * @param {GnubbyDeviceId} which The device to open. 24 * @param {GnubbyDeviceId} which The device to open.
25 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling. 25 * @param {boolean} forEnroll Whether this gnubby is being opened for enrolling.
26 * @param {FactoryOpenCallback} cb Called with result of opening the gnubby. 26 * @param {FactoryOpenCallback} cb Called with result of opening the gnubby.
27 * @param {string=} opt_appIdHash The base64-encoded hash of the app id for 27 * @param {string=} opt_appIdHash The base64-encoded hash of the app id for
28 * which the gnubby being opened. 28 * which the gnubby being opened.
29 * @param {string=} opt_logMsgUrl The url to post log messages to. 29 * @param {string=} opt_logMsgUrl The url to post log messages to.
30 * @param {string=} opt_caller Identifier for the caller. 30 * @param {string=} opt_caller Identifier for the caller.
31 * @return {undefined} no open canceller needed for this type of gnubby 31 * @return {undefined} no open canceller needed for this type of gnubby
32 * @override 32 * @override
33 */ 33 */
34 UsbGnubbyFactory.prototype.openGnubby = 34 UsbGnubbyFactory.prototype.openGnubby = function(
35 function(which, forEnroll, cb, opt_appIdHash, opt_logMsgUrl, opt_caller) { 35 which, forEnroll, cb, opt_appIdHash, opt_logMsgUrl, opt_caller) {
36 var gnubby = new Gnubby(); 36 var gnubby = new Gnubby();
37 gnubby.open(which, GnubbyEnumerationTypes.ANY, function(rc) { 37 gnubby.open(which, GnubbyEnumerationTypes.ANY, function(rc) {
38 if (rc) { 38 if (rc) {
39 cb(rc, gnubby); 39 cb(rc, gnubby);
40 return; 40 return;
41 } 41 }
42 gnubby.sync(function(rc) { 42 gnubby.sync(function(rc) {
43 cb(rc, gnubby); 43 cb(rc, gnubby);
44 }); 44 });
45 }, opt_caller); 45 }, opt_caller);
46 }; 46 };
47 47
48 /** 48 /**
49 * Enumerates gnubbies. 49 * Enumerates gnubbies.
50 * @param {function(number, Array<GnubbyDeviceId>)} cb Enumerate callback 50 * @param {function(number, Array<GnubbyDeviceId>)} cb Enumerate callback
51 */ 51 */
52 UsbGnubbyFactory.prototype.enumerate = function(cb) { 52 UsbGnubbyFactory.prototype.enumerate = function(cb) {
53 this.gnubbies_.enumerate(cb); 53 this.gnubbies_.enumerate(cb);
54 }; 54 };
55 55
56 /** 56 /**
57 * No-op prerequisite check. 57 * No-op prerequisite check.
58 * @param {Gnubby} gnubby The not-enrolled gnubby. 58 * @param {Gnubby} gnubby The not-enrolled gnubby.
59 * @param {string} appIdHash The base64-encoded hash of the app id for which 59 * @param {string} appIdHash The base64-encoded hash of the app id for which
60 * the gnubby being enrolled. 60 * the gnubby being enrolled.
61 * @param {FactoryOpenCallback} cb Called with the result of the prerequisite 61 * @param {FactoryOpenCallback} cb Called with the result of the prerequisite
62 * check. (A non-zero status indicates failure.) 62 * check. (A non-zero status indicates failure.)
63 */ 63 */
64 UsbGnubbyFactory.prototype.notEnrolledPrerequisiteCheck = 64 UsbGnubbyFactory.prototype.notEnrolledPrerequisiteCheck = function(
65 function(gnubby, appIdHash, cb) { 65 gnubby, appIdHash, cb) {
66 cb(DeviceStatusCodes.OK_STATUS, gnubby); 66 cb(DeviceStatusCodes.OK_STATUS, gnubby);
67 }; 67 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698