Index: chrome/browser/resources/file_manager/js/file_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
index 5b0602f74f5eaea3d4669b8301c3e5fc34240fec..d29de39efcc67ea3a7d0086abe2c6a555b9b6a08 100644 |
--- a/chrome/browser/resources/file_manager/js/file_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_manager.js |
@@ -2135,9 +2135,12 @@ FileManager.prototype = { |
var box = this.document_.createElement('div'); |
box.className = 'thumbnail'; |
function imageLoadCalback(index, box, img, transform) { |
- if (index == 0) |
- thumbnails.insertBefore(self.renderThumbnailZoom_(img, transform), |
- thumbnails.firstChild); |
+ if (index == 0) { |
dgozman
2012/05/18 13:15:14
Merge these changes.
Dmitry Zvorygin
2012/05/21 10:51:01
Done.
|
+ var thumbnailZoom = self.renderThumbnailZoom_(img, transform); |
+ if (thumbnailZoom) { |
+ thumbnails.insertBefore(thumbnailZoom, thumbnails.firstChild); |
+ } |
+ } |
onThumbnailLoaded(); |
} |
var thumbnail = this.renderThumbnailBox_(entry, true, |
@@ -2236,7 +2239,7 @@ FileManager.prototype = { |
var THUMBNAIL_SIZE = 45; |
if (width < THUMBNAIL_SIZE * 2 && height < THUMBNAIL_SIZE * 2) |
- return; |
+ return null; |
var scale = Math.min(1, |
IMAGE_HOVER_PREVIEW_SIZE / Math.max(width, height)); |
@@ -2430,15 +2433,17 @@ FileManager.prototype = { |
task.title = str('INSTALL_CRX'); |
} |
} |
- this.taskItems_.addItem(this.renderTaskItem_(task)); |
+ if (tasksList.length > 1) |
dgozman
2012/05/18 13:15:14
This is wrong. tasksList.length is not equal to ta
Dmitry Zvorygin
2012/05/21 10:51:01
Good point! Fixed.
|
+ this.taskItems_.addItem({label: task.title, |
+ iconUrl: task.iconUrl, task: task}); |
tasksCount++; |
if (defaultTask == null) defaultTask = task; |
} |
this.taskItems_.hidden = tasksCount == 0; |
- if (tasksCount > 1) { |
- // Duplicate default task in drop-down list. |
- this.taskItems_.addItem(this.renderTaskItem_(defaultTask)); |
+ if (defaultTask != null) { |
+ this.taskItems_.defaultItem = ({label: defaultTask.title, |
+ iconUrl: defaultTask.iconUrl, task: defaultTask}); |
} |
selection.tasksList = tasksList; |
@@ -2449,22 +2454,6 @@ FileManager.prototype = { |
} |
}; |
- FileManager.prototype.renderTaskItem_ = function(task) { |
- var item = this.document_.createElement('div'); |
- item.className = 'task-item'; |
- item.task = task; |
- |
- var img = this.document_.createElement('img'); |
- img.src = task.iconUrl; |
- item.appendChild(img); |
- |
- var label = this.document_.createElement('div'); |
- label.appendChild(this.document_.createTextNode(task.title)); |
- item.appendChild(label); |
- |
- return item; |
- }; |
- |
FileManager.prototype.getExtensionId_ = function() { |
return chrome.extension.getURL('').split('/')[2]; |
}; |