| OLD | NEW |
| 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 Loading... |
| 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 entries. |
| 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) |
| 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 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 }; |
| OLD | NEW |