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

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

Issue 917093003: Shorten Closure template notation from Array.<*> to Array<*>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cvox Created 5 years, 10 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 A multiple gnubby signer wraps the process of opening a number 6 * @fileoverview A multiple gnubby signer wraps the process of opening a number
7 * of gnubbies, signing each challenge in an array of challenges until a 7 * of gnubbies, signing each challenge in an array of challenges until a
8 * success condition is satisfied, and yielding each succeeding gnubby. 8 * success condition is satisfied, and yielding each succeeding gnubby.
9 * 9 *
10 */ 10 */
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 timeoutMillis, opt_logMsgUrl) { 45 timeoutMillis, opt_logMsgUrl) {
46 /** @private {boolean} */ 46 /** @private {boolean} */
47 this.forEnroll_ = forEnroll; 47 this.forEnroll_ = forEnroll;
48 /** @private {function(boolean)} */ 48 /** @private {function(boolean)} */
49 this.allCompleteCb_ = allCompleteCb; 49 this.allCompleteCb_ = allCompleteCb;
50 /** @private {function(MultipleSignerResult, boolean)} */ 50 /** @private {function(MultipleSignerResult, boolean)} */
51 this.gnubbyCompleteCb_ = gnubbyCompleteCb; 51 this.gnubbyCompleteCb_ = gnubbyCompleteCb;
52 /** @private {string|undefined} */ 52 /** @private {string|undefined} */
53 this.logMsgUrl_ = opt_logMsgUrl; 53 this.logMsgUrl_ = opt_logMsgUrl;
54 54
55 /** @private {Array.<SignHelperChallenge>} */ 55 /** @private {Array<SignHelperChallenge>} */
56 this.challenges_ = []; 56 this.challenges_ = [];
57 /** @private {boolean} */ 57 /** @private {boolean} */
58 this.challengesSet_ = false; 58 this.challengesSet_ = false;
59 /** @private {boolean} */ 59 /** @private {boolean} */
60 this.complete_ = false; 60 this.complete_ = false;
61 /** @private {number} */ 61 /** @private {number} */
62 this.numComplete_ = 0; 62 this.numComplete_ = 0;
63 /** @private {!Object.<string, GnubbyTracker>} */ 63 /** @private {!Object<string, GnubbyTracker>} */
64 this.gnubbies_ = {}; 64 this.gnubbies_ = {};
65 /** @private {Countdown} */ 65 /** @private {Countdown} */
66 this.timer_ = DEVICE_FACTORY_REGISTRY.getCountdownFactory() 66 this.timer_ = DEVICE_FACTORY_REGISTRY.getCountdownFactory()
67 .createTimer(timeoutMillis); 67 .createTimer(timeoutMillis);
68 /** @private {Countdown} */ 68 /** @private {Countdown} */
69 this.reenumerateTimer_ = DEVICE_FACTORY_REGISTRY.getCountdownFactory() 69 this.reenumerateTimer_ = DEVICE_FACTORY_REGISTRY.getCountdownFactory()
70 .createTimer(timeoutMillis); 70 .createTimer(timeoutMillis);
71 } 71 }
72 72
73 /** 73 /**
(...skipping 15 matching lines...) Expand all
89 } 89 }
90 this.reenumerateTimer_.clearTimeout(); 90 this.reenumerateTimer_.clearTimeout();
91 this.timer_.clearTimeout(); 91 this.timer_.clearTimeout();
92 if (this.reenumerateIntervalTimer_) { 92 if (this.reenumerateIntervalTimer_) {
93 this.reenumerateIntervalTimer_.clearTimeout(); 93 this.reenumerateIntervalTimer_.clearTimeout();
94 } 94 }
95 }; 95 };
96 96
97 /** 97 /**
98 * Begins signing the given challenges. 98 * Begins signing the given challenges.
99 * @param {Array.<SignHelperChallenge>} challenges The challenges to sign. 99 * @param {Array<SignHelperChallenge>} challenges The challenges to sign.
100 * @return {boolean} whether the challenges were successfully added. 100 * @return {boolean} whether the challenges were successfully added.
101 */ 101 */
102 MultipleGnubbySigner.prototype.doSign = function(challenges) { 102 MultipleGnubbySigner.prototype.doSign = function(challenges) {
103 if (this.challengesSet_) { 103 if (this.challengesSet_) {
104 // Can't add new challenges once they're finalized. 104 // Can't add new challenges once they're finalized.
105 return false; 105 return false;
106 } 106 }
107 107
108 if (challenges) { 108 if (challenges) {
109 for (var i = 0; i < challenges.length; i++) { 109 for (var i = 0; i < challenges.length; i++) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 * @private 141 * @private
142 */ 142 */
143 MultipleGnubbySigner.prototype.enumerateGnubbies_ = function() { 143 MultipleGnubbySigner.prototype.enumerateGnubbies_ = function() {
144 DEVICE_FACTORY_REGISTRY.getGnubbyFactory().enumerate( 144 DEVICE_FACTORY_REGISTRY.getGnubbyFactory().enumerate(
145 this.enumerateCallback_.bind(this)); 145 this.enumerateCallback_.bind(this));
146 }; 146 };
147 147
148 /** 148 /**
149 * Called with the result of enumerating gnubbies. 149 * Called with the result of enumerating gnubbies.
150 * @param {number} rc The return code from enumerating. 150 * @param {number} rc The return code from enumerating.
151 * @param {Array.<GnubbyDeviceId>} ids The gnubbies enumerated. 151 * @param {Array<GnubbyDeviceId>} ids The gnubbies enumerated.
152 * @private 152 * @private
153 */ 153 */
154 MultipleGnubbySigner.prototype.enumerateCallback_ = function(rc, ids) { 154 MultipleGnubbySigner.prototype.enumerateCallback_ = function(rc, ids) {
155 if (this.complete_) { 155 if (this.complete_) {
156 return; 156 return;
157 } 157 }
158 if (rc || !ids || !ids.length) { 158 if (rc || !ids || !ids.length) {
159 this.maybeReEnumerateGnubbies_(true); 159 this.maybeReEnumerateGnubbies_(true);
160 return; 160 return;
161 } 161 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 'code': result.code, 344 'code': result.code,
345 'gnubby': result.gnubby, 345 'gnubby': result.gnubby,
346 'gnubbyId': tracker.signer.getDeviceId() 346 'gnubbyId': tracker.signer.getDeviceId()
347 }; 347 };
348 if (result['challenge']) 348 if (result['challenge'])
349 signResult['challenge'] = result['challenge']; 349 signResult['challenge'] = result['challenge'];
350 if (result['info']) 350 if (result['info'])
351 signResult['info'] = result['info']; 351 signResult['info'] = result['info'];
352 this.gnubbyCompleteCb_(signResult, moreExpected); 352 this.gnubbyCompleteCb_(signResult, moreExpected);
353 }; 353 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/cryptotoken/gnubbyfactory.js ('k') | chrome/browser/resources/cryptotoken/origincheck.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698