Index: chrome/browser/resources/file_manager/js/navigation_list.js |
diff --git a/chrome/browser/resources/file_manager/js/navigation_list.js b/chrome/browser/resources/file_manager/js/navigation_list.js |
index 8fa40e9911ee69113b31bc83c125050027eb63c7..5e35db299926bac3ae40f885dee12f4b762d1142 100644 |
--- a/chrome/browser/resources/file_manager/js/navigation_list.js |
+++ b/chrome/browser/resources/file_manager/js/navigation_list.js |
@@ -446,17 +446,6 @@ NavigationList.prototype = { |
__proto__: cr.ui.List.prototype, |
set dataModel(dataModel) { |
- if (!this.boundHandleListChanged_) |
- this.boundHandleListChanged_ = this.onListContentChanged_.bind(this); |
- |
- if (this.dataModel_) { |
- dataModel.removeEventListener('change', this.boundHandleListChanged_); |
- dataModel.removeEventListener('permuted', this.boundHandleListChanged_); |
- } |
- |
- dataModel.addEventListener('change', this.boundHandleListChanged_); |
- dataModel.addEventListener('permuted', this.boundHandleListChanged_); |
- |
var parentSetter = cr.ui.List.prototype.__lookupSetter__('dataModel'); |
return parentSetter.call(this, dataModel); |
}, |
@@ -692,11 +681,20 @@ NavigationList.prototype.onCurrentDirectoryChanged_ = function(event) { |
}; |
/** |
- * Invoked when the content in the data model is changed. |
- * @param {Event} event The event. |
+ * Redraw the list. |
+ * @override |
+ */ |
+NavigationList.prototype.redraw = function() { |
+ // Calls the parent class method. |
+ cr.ui.List.prototype.redraw.call(this); |
+ this.onListContentChanged_(); |
hirono
2013/09/03 09:47:21
It seems that the redraw event is raised at the sc
yoshiki
2013/09/04 13:21:11
Thanks for good catching. I've found it can be fix
|
+}; |
+ |
+/** |
+ * Invoked when the elements in the list is updated. |
* @private |
*/ |
-NavigationList.prototype.onListContentChanged_ = function(event) { |
+NavigationList.prototype.onListContentChanged_ = function() { |
this.selectBestMatchItem_(); |
}; |
@@ -706,6 +704,9 @@ NavigationList.prototype.onListContentChanged_ = function(event) { |
* @private |
*/ |
NavigationList.prototype.selectBestMatchItem_ = function() { |
+ if (!this.dataModel) |
+ return; |
+ |
var entry = this.directoryModel_.getCurrentDirEntry(); |
var path = entry && entry.fullPath; |
if (!path) |