Index: ui/file_manager/file_manager/background/js/drive_sync_handler.js |
diff --git a/ui/file_manager/file_manager/background/js/drive_sync_handler.js b/ui/file_manager/file_manager/background/js/drive_sync_handler.js |
index f655957ebecb09184905ab6f91a9134972bd7aca..18cf498405f4598721c0f0c6d5a893377d5cc48a 100644 |
--- a/ui/file_manager/file_manager/background/js/drive_sync_handler.js |
+++ b/ui/file_manager/file_manager/background/js/drive_sync_handler.js |
@@ -85,13 +85,18 @@ DriveSyncHandler.prototype.onFileTransfersUpdated_ = function(statusList) { |
for (var i = 0; i < statusList.length; i++) { |
var status = statusList[i]; |
switch (status.transferState) { |
+ case 'added': |
+ this.removeItem_(status,'sync'); |
hirono
2014/08/27 08:37:20
Please make the 'sync' constant.
hirono
2014/08/27 08:37:21
Can we just update the item?
iseki
2014/08/28 07:13:32
Done.
iseki
2014/08/28 07:13:32
Done.
|
+ this.updateItem_(status, 'sync'); |
+ break; |
case 'in_progress': |
case 'started': |
- this.updateItem_(status); |
+ this.removeItem_(status, 'sync'); |
+ this.updateItem_(status, 'sync'); |
break; |
case 'completed': |
case 'failed': |
- this.removeItem_(status); |
+ this.removeItem_(status, 'sync'); |
if (!this.syncing) |
this.dispatchEvent(new Event(DriveSyncHandler.COMPLETED_EVENT)); |
break; |
@@ -105,9 +110,10 @@ DriveSyncHandler.prototype.onFileTransfersUpdated_ = function(statusList) { |
/** |
* Updates the item involved with the given status. |
* @param {FileTransferStatus} status Transfer status. |
+ * @patam {String} label which indicate a lamp of process. |
hirono
2014/08/27 08:37:20
The style of JSDoc for parameters is:
@param {typ
hirono
2014/08/27 08:37:21
@patam -> @param
String -> string
String is primit
iseki
2014/08/28 07:13:32
Done.
iseki
2014/08/28 07:13:32
Done.
|
* @private |
*/ |
-DriveSyncHandler.prototype.updateItem_ = function(status) { |
+DriveSyncHandler.prototype.updateItem_ = function(status, label) { |
hirono
2014/08/27 08:37:20
The label sounds like a text displayed in UI eleme
iseki
2014/08/28 07:13:32
Done.
|
this.queue_.run(function(callback) { |
if (this.items_[status.fileUrl]) { |
callback(); |
@@ -119,9 +125,13 @@ DriveSyncHandler.prototype.updateItem_ = function(status) { |
DriveSyncHandler.PROGRESS_ITEM_ID_PREFIX + (this.idCounter_++); |
item.type = ProgressItemType.SYNC; |
item.quiet = true; |
- item.message = strf('SYNC_FILE_NAME', entry.name); |
+ if (status.num_total_jobs > 1) { |
+ item.message = strf('SYNC_FILE_NAME', status.num_total_jobs + ' items'); |
hirono
2014/08/27 08:37:21
'items' should be a part of locale string.
This ca
|
+ } else { |
+ item.message = strf('SYNC_FILE_NAME', entry.name); |
+ } |
item.cancelCallback = this.requestCancel_.bind(this, entry); |
- this.items_[status.fileUrl] = item; |
+ this.items_[label] = item; |
callback(); |
}.bind(this), function(error) { |
console.warn('Resolving URL ' + status.fileUrl + ' is failed: ', error); |
@@ -129,7 +139,7 @@ DriveSyncHandler.prototype.updateItem_ = function(status) { |
}); |
}.bind(this)); |
this.queue_.run(function(callback) { |
- var item = this.items_[status.fileUrl]; |
+ var item = this.items_[label]; |
if (!item) { |
callback(); |
return; |
@@ -144,11 +154,12 @@ DriveSyncHandler.prototype.updateItem_ = function(status) { |
/** |
* Removes the item involved with the given status. |
* @param {FileTransferStatus} status Transfer status. |
+ * @patam {String} label which indicate a lamp of process. |
hirono
2014/08/27 08:37:20
ditto.
iseki
2014/08/28 07:13:32
Done.
|
* @private |
*/ |
-DriveSyncHandler.prototype.removeItem_ = function(status) { |
+DriveSyncHandler.prototype.removeItem_ = function(status, label) { |
this.queue_.run(function(callback) { |
- var item = this.items_[status.fileUrl]; |
+ var item = this.items_[label]; |
if (!item) { |
callback(); |
return; |
@@ -156,7 +167,7 @@ DriveSyncHandler.prototype.removeItem_ = function(status) { |
item.state = status.transferState === 'completed' ? |
ProgressItemState.COMPLETED : ProgressItemState.CANCELED; |
this.progressCenter_.updateItem(item); |
- delete this.items_[status.fileUrl]; |
+ delete this.items_[label]; |
callback(); |
}.bind(this)); |
}; |