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

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/function_sequence.js

Issue 12262003: [Cleanup] Files.app: Adds missing periods at the end of the descriptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * @constructor 6 * @constructor
7 * @class FunctionSequence to invoke steps in sequence 7 * @class FunctionSequence to invoke steps in sequence
8 * 8 *
9 * @param {Array} steps array of functions to invoke in sequence 9 * @param {Array} steps array of functions to invoke in sequence.
10 * @param {Object} logger logger 10 * @param {Object} logger logger.
11 * @param {Function} [callback] callback to invoke on success 11 * @param {Function} [callback] callback to invoke on success.
12 * @param {Function} [failureCallback] callback to invoke on failure 12 * @param {Function} [failureCallback] callback to invoke on failure.
13 */ 13 */
14 function FunctionSequence(name, steps, logger, callback, failureCallback) { 14 function FunctionSequence(name, steps, logger, callback, failureCallback) {
15 // Private variables hidden in closure 15 // Private variables hidden in closure
16 this.currentStepIdx_ = -1; 16 this.currentStepIdx_ = -1;
17 this.failed_ = false; 17 this.failed_ = false;
18 this.steps_ = steps; 18 this.steps_ = steps;
19 this.callback_ = callback; 19 this.callback_ = callback;
20 this.failureCallback_ = failureCallback; 20 this.failureCallback_ = failureCallback;
21 this.logger = logger; 21 this.logger = logger;
22 this.name = name; 22 this.name = name;
23 23
24 this.onError = this.onError_.bind(this); 24 this.onError = this.onError_.bind(this);
25 this.finish = this.finish_.bind(this); 25 this.finish = this.finish_.bind(this);
26 this.nextStep = this.nextStep_.bind(this); 26 this.nextStep = this.nextStep_.bind(this);
27 this.apply = this.apply_.bind(this); 27 this.apply = this.apply_.bind(this);
28 } 28 }
29 29
30 /** 30 /**
31 * Sets new callback 31 * Sets new callback
32 * 32 *
33 * @param {Function} callback new callback to call on succeed 33 * @param {Function} callback new callback to call on succeed.
34 */ 34 */
35 FunctionSequence.prototype.setCallback = function(callback) { 35 FunctionSequence.prototype.setCallback = function(callback) {
36 this.callback_ = callback; 36 this.callback_ = callback;
37 }; 37 };
38 38
39 /** 39 /**
40 * Sets new error callback 40 * Sets new error callback
41 * 41 *
42 * @param {Function} failureCallback new callback to call on failure 42 * @param {Function} failureCallback new callback to call on failure.
43 */ 43 */
44 FunctionSequence.prototype.setFailureCallback = function(failureCallback) { 44 FunctionSequence.prototype.setFailureCallback = function(failureCallback) {
45 this.failureCallback_ = failureCallback; 45 this.failureCallback_ = failureCallback;
46 }; 46 };
47 47
48 48
49 /** 49 /**
50 * Error handling function, which traces current error step, stops sequence 50 * Error handling function, which traces current error step, stops sequence
51 * advancing and fires error callback. 51 * advancing and fires error callback.
52 * 52 *
53 * @param err error message 53 * @param err error message.
54 */ 54 */
55 FunctionSequence.prototype.onError_ = function(err) { 55 FunctionSequence.prototype.onError_ = function(err) {
56 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name 56 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name
57 + ': ' 57 + ': '
58 + err); 58 + err);
59 if (!this.failed_) { 59 if (!this.failed_) {
60 this.failed_ = true; 60 this.failed_ = true;
61 this.failureCallback_(err); 61 this.failureCallback_(err);
62 } 62 }
63 }; 63 };
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 this.nextStep.apply(this, arguments); 115 this.nextStep.apply(this, arguments);
116 }; 116 };
117 117
118 /** 118 /**
119 * Add Function object mimics to FunctionSequence 119 * Add Function object mimics to FunctionSequence
120 */ 120 */
121 FunctionSequence.prototype.apply_ = function(obj, args) { 121 FunctionSequence.prototype.apply_ = function(obj, args) {
122 this.start.apply(this, args); 122 this.start.apply(this, args);
123 }; 123 };
124 124
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698