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

Side by Side Diff: chrome/browser/resources/file_manager/foreground/js/directory_model.js

Issue 109973002: Migrate from URLs to Entries in the Files App's gallery. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 years 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
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 // If directory files changes too often, don't rescan directory more than once 7 // If directory files changes too often, don't rescan directory more than once
8 // per specified interval 8 // per specified interval
9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; 9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000;
10 // Used for operations that require almost instant rescan. 10 // Used for operations that require almost instant rescan.
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 var fileList = this.getFileList(); 932 var fileList = this.getFileList();
933 for (var i = 0; i < fileList.length; i++) { 933 for (var i = 0; i < fileList.length; i++) {
934 if (fileList.item(i).toURL() === entry.toURL()) { 934 if (fileList.item(i).toURL() === entry.toURL()) {
935 this.selectIndex(i); 935 this.selectIndex(i);
936 return; 936 return;
937 } 937 }
938 } 938 }
939 }; 939 };
940 940
941 /** 941 /**
942 * @param {Array.<string>} urls Array of URLs. 942 * @param {Array.<string>} entries Array of URLs.
hirono 2013/12/09 06:53:50 nit: Please fix the comment.
mtomasz 2013/12/10 02:37:34 Done.
943 */ 943 */
944 DirectoryModel.prototype.selectUrls = function(urls) { 944 DirectoryModel.prototype.selectEntries = function(entries) {
945 // URLs are needed here, since we are comparing Entries by URLs.
946 var urls = util.entriesToURLs(entries);
945 var fileList = this.getFileList(); 947 var fileList = this.getFileList();
946 this.fileListSelection_.beginChange(); 948 this.fileListSelection_.beginChange();
947 this.fileListSelection_.unselectAll(); 949 this.fileListSelection_.unselectAll();
948 for (var i = 0; i < fileList.length; i++) { 950 for (var i = 0; i < fileList.length; i++) {
949 if (urls.indexOf(fileList.item(i).toURL()) >= 0) 951 if (urls.indexOf(fileList.item(i).toURL()) >= 0)
hirono 2013/12/09 06:53:50 1. Is it also needed to select child entries? 2.
mtomasz 2013/12/10 02:37:34 I don't think so. This code just checks if the url
950 this.fileListSelection_.setIndexSelected(i, true); 952 this.fileListSelection_.setIndexSelected(i, true);
951 } 953 }
952 this.fileListSelection_.endChange(); 954 this.fileListSelection_.endChange();
953 }; 955 };
954 956
955 /** 957 /**
956 * @param {number} index Index of file. 958 * @param {number} index Index of file.
957 */ 959 */
958 DirectoryModel.prototype.selectIndex = function(index) { 960 DirectoryModel.prototype.selectIndex = function(index) {
959 // this.focusCurrentList_(); 961 // this.focusCurrentList_();
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 if (this.onSearchCompleted_) { 1162 if (this.onSearchCompleted_) {
1161 this.removeEventListener('scan-completed', this.onSearchCompleted_); 1163 this.removeEventListener('scan-completed', this.onSearchCompleted_);
1162 this.onSearchCompleted_ = null; 1164 this.onSearchCompleted_ = null;
1163 } 1165 }
1164 1166
1165 if (this.onClearSearch_) { 1167 if (this.onClearSearch_) {
1166 this.onClearSearch_(); 1168 this.onClearSearch_();
1167 this.onClearSearch_ = null; 1169 this.onClearSearch_ = null;
1168 } 1170 }
1169 }; 1171 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698