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 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {MetadataCache} metadataCache Metadata cache service. | 7 * @param {MetadataCache} metadataCache Metadata cache service. |
8 * @param {cr.ui.ArrayDataModel} fileList The file list. | 8 * @param {cr.ui.ArrayDataModel} fileList The file list. |
9 * @param {boolean} showHidden If files starting with '.' are shown. | 9 * @param {boolean} showHidden If files starting with '.' are shown. |
10 */ | 10 */ |
11 function FileListContext(metadataCache, fileList, showHidden) { | 11 function FileListContext(metadataCache, fileList, showHidden) { |
12 /** | 12 /** |
13 * @type {MetadataCache} | 13 * @type {MetadataCache} |
14 */ | 14 */ |
15 this.metadataCache = metadataCache; | 15 this.metadataCache = metadataCache; |
16 /** | 16 /** |
17 * @type {cr.ui.ArrayDataModel} | 17 * @type {cr.ui.ArrayDataModel} |
18 */ | 18 */ |
19 this.fileList = fileList; | 19 this.fileList = fileList; |
20 /** | 20 /** |
21 * @type Object.<string, Function> | 21 * @type Object.<string, Function> |
22 * @private | 22 * @private |
23 */ | 23 */ |
24 this.filters_ = {}; | 24 this.filters_ = {}; |
25 this.setFilterHidden(!showHidden); | 25 this.setFilterHidden(!showHidden); |
| 26 |
| 27 // Do not show entries marked as 'deleted'. |
| 28 this.addFilter('deleted', function(entry) { |
| 29 var internal = this.metadataCache.getCached(entry, 'internal'); |
| 30 return !(internal && internal.deleted); |
| 31 }.bind(this)); |
26 } | 32 } |
27 | 33 |
28 /** | 34 /** |
29 * @param {string} name Filter identifier. | 35 * @param {string} name Filter identifier. |
30 * @param {Function(Entry)} callback A filter — a function receiving an Entry, | 36 * @param {Function(Entry)} callback A filter — a function receiving an Entry, |
31 * and returning bool. | 37 * and returning bool. |
32 */ | 38 */ |
33 FileListContext.prototype.addFilter = function(name, callback) { | 39 FileListContext.prototype.addFilter = function(name, callback) { |
34 this.filters_[name] = callback; | 40 this.filters_[name] = callback; |
35 }; | 41 }; |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 }.bind(this); | 593 }.bind(this); |
588 | 594 |
589 getNextChunk(); | 595 getNextChunk(); |
590 }; | 596 }; |
591 | 597 |
592 /** | 598 /** |
593 * We get results for each directory in one go in scanDirectory_. | 599 * We get results for each directory in one go in scanDirectory_. |
594 */ | 600 */ |
595 DirectoryContentsLocalSearch.prototype.readNextChunk = function() { | 601 DirectoryContentsLocalSearch.prototype.readNextChunk = function() { |
596 }; | 602 }; |
OLD | NEW |