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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_copy_manager_wrapper.js

Issue 10828153: Change butter bar message depending on the type of operation and the number of files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove debug output. Created 8 years, 4 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 var fileCopyManagerWrapper = null; 5 var fileCopyManagerWrapper = null;
6 6
7 /** 7 /**
8 * While FileCopyManager is run in the background page, this class is used to 8 * While FileCopyManager is run in the background page, this class is used to
9 * communicate with it. 9 * communicate with it.
10 * @constructor 10 * @constructor
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 FileCopyManagerWrapper.prototype.onEvent = function(eventName, eventArgs) { 63 FileCopyManagerWrapper.prototype.onEvent = function(eventName, eventArgs) {
64 var event = new cr.Event(eventName); 64 var event = new cr.Event(eventName);
65 for (var arg in eventArgs) 65 for (var arg in eventArgs)
66 if (eventArgs.hasOwnProperty(arg)) 66 if (eventArgs.hasOwnProperty(arg))
67 event[arg] = eventArgs[arg]; 67 event[arg] = eventArgs[arg];
68 68
69 this.dispatchEvent(event); 69 this.dispatchEvent(event);
70 }; 70 };
71 71
72 /** 72 /**
73 * Get the overall progress data of all queued copy tasks.
74 * @return {Object} An object containing the following parameters:
75 * percentage - The percentage (0-1) of finished items.
76 * pendingItems - The number of pending/unfinished items.
77 */
78 FileCopyManagerWrapper.prototype.getProgress = function() {
79 var cm = this.getCopyManagerSync_();
80 if (cm)
81 return cm.getProgress();
82
83 return {percentage: NaN, pendingItems: 0};
84 };
85
86 /**
87 * @return {Object} Status object. 73 * @return {Object} Status object.
88 */ 74 */
89 FileCopyManagerWrapper.prototype.getStatus = function() { 75 FileCopyManagerWrapper.prototype.getStatus = function() {
90 var cm = this.getCopyManagerSync_(); 76 var cm = this.getCopyManagerSync_();
91 if (cm) 77 if (cm)
92 return cm.getStatus(); 78 return cm.getStatus();
93 79
94 return { 80 return {
95 pendingItems: 0, 81 pendingItems: 0,
96 pendingFiles: 0, 82 pendingFiles: 0,
97 pendingDirectories: 0, 83 pendingDirectories: 0,
98 pendingBytes: 0, 84 pendingBytes: 0,
99 85
100 completedItems: 0, 86 completedItems: 0,
101 completedFiles: 0, 87 completedFiles: 0,
102 completedDirectories: 0, 88 completedDirectories: 0,
103 completedBytes: 0, 89 completedBytes: 0,
104 90
105 totalItems: 0, 91 totalItems: 0,
106 totalFiles: 0, 92 totalFiles: 0,
107 totalDirectories: 0, 93 totalDirectories: 0,
108 totalBytes: 0 94 totalBytes: 0,
95
96 percentage: NaN,
97 pendingCopies: 0,
98 pendingMoves: 0,
99 filename: '' // In case pendingItems == 1
109 }; 100 };
110 }; 101 };
111 102
112 /** 103 /**
113 * Request that the current copy queue be abandoned. 104 * Request that the current copy queue be abandoned.
114 * @param {Function} opt_callback On cancel. 105 * @param {Function} opt_callback On cancel.
115 */ 106 */
116 FileCopyManagerWrapper.prototype.requestCancel = function(opt_callback) { 107 FileCopyManagerWrapper.prototype.requestCancel = function(opt_callback) {
117 this.getCopyManagerAsync_( 108 this.getCopyManagerAsync_(
118 function(cm) { 109 function(cm) {
119 cm.requestCancel(opt_callback); 110 cm.requestCancel(opt_callback);
120 }); 111 });
121 }; 112 };
122 113
123 /** 114 /**
124 * Convert string in clipboard to entries and kick off pasting. 115 * Convert string in clipboard to entries and kick off pasting.
125 * @param {Object} clipboard Clipboard contents. 116 * @param {Object} clipboard Clipboard contents.
126 * @param {string} targetPath Target path. 117 * @param {string} targetPath Target path.
127 * @param {boolean} targetOnGData If target is on GDrive. 118 * @param {boolean} targetOnGData If target is on GDrive.
128 */ 119 */
129 FileCopyManagerWrapper.prototype.paste = function(clipboard, targetPath, 120 FileCopyManagerWrapper.prototype.paste = function(clipboard, targetPath,
130 targetOnGData) { 121 targetOnGData) {
131 this.getCopyManagerAsync_( 122 this.getCopyManagerAsync_(
132 function(cm) { 123 function(cm) {
133 cm.paste(clipboard, targetPath, targetOnGData); 124 cm.paste(clipboard, targetPath, targetOnGData);
134 }); 125 });
135 }; 126 };
136 127
OLDNEW
« no previous file with comments | « chrome/browser/resources/file_manager/js/file_copy_manager.js ('k') | chrome/browser/resources/file_manager/js/mock_chrome.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698