Index: trunk/src/chrome/browser/resources/file_manager/foreground/js/directory_contents.js |
=================================================================== |
--- trunk/src/chrome/browser/resources/file_manager/foreground/js/directory_contents.js (revision 248206) |
+++ trunk/src/chrome/browser/resources/file_manager/foreground/js/directory_contents.js (working copy) |
@@ -323,10 +323,11 @@ |
* When filters are changed, a 'changed' event is fired. |
* |
* @param {MetadataCache} metadataCache Metadata cache service. |
+ * @param {boolean} showHidden If files starting with '.' are shown. |
* @constructor |
* @extends {cr.EventTarget} |
*/ |
-function FileFilter(metadataCache) { |
+function FileFilter(metadataCache, showHidden) { |
/** |
* @type {MetadataCache} |
* @private |
@@ -338,6 +339,7 @@ |
* @private |
*/ |
this.filters_ = {}; |
+ this.setFilterHidden(!showHidden); |
// Do not show entries marked as 'deleted'. |
this.addFilter('deleted', function(entry) { |
@@ -370,6 +372,27 @@ |
}; |
/** |
+ * @param {boolean} value If do not show hidden files. |
+ */ |
+FileFilter.prototype.setFilterHidden = function(value) { |
+ if (value) { |
+ this.addFilter( |
+ 'hidden', |
+ function(entry) { return entry.name.substr(0, 1) !== '.'; } |
+ ); |
+ } else { |
+ this.removeFilter('hidden'); |
+ } |
+}; |
+ |
+/** |
+ * @return {boolean} If the files with names starting with "." are not shown. |
+ */ |
+FileFilter.prototype.isFilterHiddenOn = function() { |
+ return 'hidden' in this.filters_; |
+}; |
+ |
+/** |
* @param {Entry} entry File entry. |
* @return {boolean} True if the file should be shown, false otherwise. |
*/ |