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

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js

Issue 651403002: Fix trivial type-check errors in file_manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and correct a comment. Created 6 years, 2 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: ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js b/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
index 698576b719b7e350372a254e82f644efb7691111..2047e31f1c69b791b07155706e95300a9e7f583d 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/progress_center_panel.js
@@ -6,8 +6,9 @@
/**
* Item element of the progress center.
- * @param {HTMLDocument} document Document which the new item belongs to.
+ * @param {Document} document Document which the new item belongs to.
* @constructor
+ * @extends {HTMLDivElement}
*/
function ProgressCenterItemElement(document) {
var label = document.createElement('label');
@@ -68,11 +69,12 @@ ProgressCenterItemElement.PROGRESS_ANIMATION_END_EVENT = 'progressAnimationEnd';
/**
* Decorates the given element as a progress item.
- * @param {HTMLElement} element Item to be decorated.
+ * @param {Element} element Item to be decorated.
* @return {ProgressCenterItemElement} Decorated item.
*/
ProgressCenterItemElement.decorate = function(element) {
element.__proto__ = ProgressCenterItemElement.prototype;
+ element = /** @type {ProgressCenterItemElement} */ (element);
element.state_ = ProgressItemState.PROGRESSING;
element.track_ = element.querySelector('.progress-track');
element.track_.addEventListener('webkitTransitionEnd',
@@ -119,7 +121,7 @@ ProgressCenterItemElement.prototype.update = function(item, animated) {
// Set track width.
var setWidth = function(nextWidthFrame) {
- var currentWidthRate = parseInt(this.track_.style.width);
+ var currentWidthRate = parseInt(this.track_.style.width, 10);
// Prevent assigning the same width to avoid stopping the animation.
// animated == false may be intended to cancel the animation, so in that
// case, the assignment should be done.
@@ -172,21 +174,21 @@ ProgressCenterItemElement.prototype.onTransitionEnd_ = function(event) {
function ProgressCenterPanel(element) {
/**
* Root element of the progress center.
- * @type {HTMLElement}
+ * @type {Element}
* @private
*/
this.element_ = element;
/**
* Open view containing multiple progress items.
- * @type {HTMLElement}
+ * @type {Element}
* @private
*/
this.openView_ = this.element_.querySelector('#progress-center-open-view');
/**
* Close view that is a summarized progress item.
- * @type {HTMLElement}
+ * @type {ProgressCenterItemElement}
* @private
*/
this.closeView_ = ProgressCenterItemElement.decorate(
@@ -253,7 +255,7 @@ function ProgressCenterPanel(element) {
/**
* Obtains the toggle animation keyframes rule from the document.
- * @param {HTMLDocument} document Document containing the rule.
+ * @param {Document} document Document containing the rule.
* @return {CSSKeyframeRule} Animation rule.
* @private
*/
@@ -425,12 +427,13 @@ ProgressCenterPanel.prototype.updateCloseView_ = function() {
/**
* Gets an item element having the specified ID.
* @param {string} id progress item ID.
- * @return {HTMLElement} Item element having the ID.
+ * @return {ProgressCenterItemElement} Item element having the ID.
* @private
*/
ProgressCenterPanel.prototype.getItemElement_ = function(id) {
var query = 'li[data-progress-id="' + id + '"]';
- return this.openView_.querySelector(query);
+ return /** @type {ProgressCenterItemElement} */ (
+ this.openView_.querySelector(query));
};
/**

Powered by Google App Engine
This is Rietveld 408576698