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

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

Issue 23618028: [Files.app] Refile a timing of doing selectBestMatchItem(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698