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

Unified Diff: chrome/browser/resources/file_manager/js/file_selection.js

Issue 23462020: Let the description text in the preview panels managed by PreviewPanel class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the comment. Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/ui/preview_panel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/file_selection.js
diff --git a/chrome/browser/resources/file_manager/js/file_selection.js b/chrome/browser/resources/file_manager/js/file_selection.js
index 0f7fc0fc2e5ec787287c620f257ede471bae325c..1983dd0e06a2d828a1fbbcfc8321d50c6cc1f01b 100644
--- a/chrome/browser/resources/file_manager/js/file_selection.js
+++ b/chrome/browser/resources/file_manager/js/file_selection.js
@@ -228,8 +228,6 @@ FileSelectionHandler.prototype.onFileSelectionChanged = function(event) {
this.selectionUpdateTimer_ = null;
}
- this.hideCalculating_();
-
// The rest of the selection properties are computed via (sometimes lengthy)
// asynchronous calls. We initiate these calls after a timeout. If the
// selection is changing quickly we only do this once when it slows down.
@@ -250,17 +248,6 @@ FileSelectionHandler.prototype.onFileSelectionChanged = function(event) {
};
/**
- * Clears the primary UI selection elements.
- */
-FileSelectionHandler.prototype.clearUI = function() {
- this.previewThumbnails_.textContent = '';
- this.previewText_.textContent = '';
- this.hideCalculating_();
- this.taskItems_.hidden = true;
- this.okButton_.disabled = true;
-};
-
-/**
* Updates the Ok button enabled state.
*
* @return {boolean} Whether button is enabled.
@@ -315,92 +302,6 @@ FileSelectionHandler.prototype.isFileSelectionAvailable = function() {
};
/**
- * Update the selection summary in preview panel.
- *
- * @private
- */
-FileSelectionHandler.prototype.updatePreviewPanelText_ = function() {
- var selection = this.selection;
- if (selection.totalCount <= 1) {
- // Hides the preview text if zero or one file is selected. We shows a
- // breadcrumb list instead on the preview panel.
- this.hideCalculating_();
- this.previewText_.textContent = '';
- return;
- }
-
- var text = '';
- if (selection.totalCount == 1) {
- text = selection.entries[0].name;
- } else if (selection.directoryCount == 0) {
- text = strf('MANY_FILES_SELECTED', selection.fileCount);
- } else if (selection.fileCount == 0) {
- text = strf('MANY_DIRECTORIES_SELECTED', selection.directoryCount);
- } else {
- text = strf('MANY_ENTRIES_SELECTED', selection.totalCount);
- }
-
- if (selection.bytesKnown) {
- this.hideCalculating_();
- if (selection.showBytes) {
- var bytes = util.bytesToString(selection.bytes);
- text += ', ' + bytes;
- }
- } else {
- this.showCalculating_();
- }
-
- this.previewText_.textContent = text;
-};
-
-/**
- * Displays the 'calculating size' label.
- *
- * @private
- */
-FileSelectionHandler.prototype.showCalculating_ = function() {
- if (this.animationTimeout_) {
- clearTimeout(this.animationTimeout_);
- this.animationTimeout_ = null;
- }
-
- var dotCount = 0;
-
- var advance = function() {
- this.animationTimeout_ = setTimeout(advance, 1000);
-
- var s = this.calculatingSize_.textContent;
- s = s.replace(/(\.)+$/, '');
- for (var i = 0; i < dotCount; i++) {
- s += '.';
- }
- this.calculatingSize_.textContent = s;
-
- dotCount = (dotCount + 1) % 3;
- }.bind(this);
-
- var start = function() {
- this.calculatingSize_.hidden = false;
- advance();
- }.bind(this);
-
- this.animationTimeout_ = setTimeout(start, 500);
-};
-
-/**
- * Hides the 'calculating size' label.
- *
- * @private
- */
-FileSelectionHandler.prototype.hideCalculating_ = function() {
- if (this.animationTimeout_) {
- clearTimeout(this.animationTimeout_);
- this.animationTimeout_ = null;
- }
- this.calculatingSize_.hidden = true;
-};
-
-/**
* Calculates async selection stats and updates secondary UI elements.
*
* @param {FileSelection} selection The selection object.
@@ -430,16 +331,8 @@ FileSelectionHandler.prototype.updateFileSelectionAsync = function(selection) {
];
} else {
thumbnailEntries = selection.entries;
- if (selection.totalCount != 1) {
- selection.computeBytes(function() {
- if (this.selection != selection)
- return;
- this.updatePreviewPanelText_();
- }.bind(this));
- }
}
- this.previewPanel_.entries = selection.entries;
- this.updatePreviewPanelText_();
+ this.previewPanel_.setSelection(selection);
this.showPreviewThumbnails_(thumbnailEntries);
// Update breadcrums.
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/ui/preview_panel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698