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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Entry of NavigationListModel. This construtor should be called only from 8 * Entry of NavigationListModel. This construtor should be called only from
9 * the helper methods (NavigationModelItem.createWithPath/createWithEntry). 9 * the helper methods (NavigationModelItem.createWithPath/createWithEntry).
10 * 10 *
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 function NavigationList() { 439 function NavigationList() {
440 } 440 }
441 441
442 /** 442 /**
443 * NavigationList inherits cr.ui.List. 443 * NavigationList inherits cr.ui.List.
444 */ 444 */
445 NavigationList.prototype = { 445 NavigationList.prototype = {
446 __proto__: cr.ui.List.prototype, 446 __proto__: cr.ui.List.prototype,
447 447
448 set dataModel(dataModel) { 448 set dataModel(dataModel) {
449 if (!this.boundHandleListChanged_) 449 if (!this.onListContentChangedBound_)
450 this.boundHandleListChanged_ = this.onListContentChanged_.bind(this); 450 this.onListContentChangedBound_ = this.onListContentChanged_.bind(this);
451 451
452 if (this.dataModel_) { 452 if (this.dataModel_) {
453 dataModel.removeEventListener('change', this.boundHandleListChanged_); 453 this.dataModel_.removeEventListener(
454 dataModel.removeEventListener('permuted', this.boundHandleListChanged_); 454 'change', this.onListContentChangedBound_);
455 this.dataModel_.removeEventListener(
456 'permuted', this.onListContentChangedBound_);
455 } 457 }
456 458
457 dataModel.addEventListener('change', this.boundHandleListChanged_); 459 var parentSetter = cr.ui.List.prototype.__lookupSetter__('dataModel');
458 dataModel.addEventListener('permuted', this.boundHandleListChanged_); 460 parentSetter.call(this, dataModel);
459 461
460 var parentSetter = cr.ui.List.prototype.__lookupSetter__('dataModel'); 462 // This must be placed after the parent method is called, in order to make
461 return parentSetter.call(this, dataModel); 463 // it sure that the list was changed.
464 dataModel.addEventListener('change', this.onListContentChangedBound_);
465 dataModel.addEventListener('permuted', this.onListContentChangedBound_);
462 }, 466 },
463 467
464 get dataModel() { 468 get dataModel() {
465 return this.dataModel_; 469 return this.dataModel_;
466 }, 470 },
467 471
468 // TODO(yoshiki): Add a setter of 'directoryModel'. 472 // TODO(yoshiki): Add a setter of 'directoryModel'.
469 }; 473 };
470 474
471 /** 475 /**
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 var itemPath = this.dataModel.item(i).path; 741 var itemPath = this.dataModel.item(i).path;
738 if (PathUtil.getRootPath(itemPath) == newRootPath) { 742 if (PathUtil.getRootPath(itemPath) == newRootPath) {
739 // Not to invoke the handler of this instance, sets the guard. 743 // Not to invoke the handler of this instance, sets the guard.
740 this.dontHandleSelectionEvent_ = true; 744 this.dontHandleSelectionEvent_ = true;
741 this.selectionModel.selectedIndex = i; 745 this.selectionModel.selectedIndex = i;
742 this.dontHandleSelectionEvent_ = false; 746 this.dontHandleSelectionEvent_ = false;
743 return; 747 return;
744 } 748 }
745 } 749 }
746 }; 750 };
OLDNEW
« 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