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

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

Issue 140893006: [Files.app] Show dot files in the Drive volume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a comment Created 6 years, 10 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 | chrome/browser/resources/file_manager/foreground/js/file_manager.js » ('j') | 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 * Scanner of the entries. 8 * Scanner of the entries.
9 * @constructor 9 * @constructor
10 */ 10 */
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 entriesCallback(entries); 316 entriesCallback(entries);
317 successCallback(); 317 successCallback();
318 }.bind(this)); 318 }.bind(this));
319 }; 319 };
320 320
321 /** 321 /**
322 * This class manages filters and determines a file should be shown or not. 322 * This class manages filters and determines a file should be shown or not.
323 * When filters are changed, a 'changed' event is fired. 323 * When filters are changed, a 'changed' event is fired.
324 * 324 *
325 * @param {MetadataCache} metadataCache Metadata cache service. 325 * @param {MetadataCache} metadataCache Metadata cache service.
326 * @param {boolean} showHidden If files starting with '.' are shown.
327 * @constructor 326 * @constructor
328 * @extends {cr.EventTarget} 327 * @extends {cr.EventTarget}
329 */ 328 */
330 function FileFilter(metadataCache, showHidden) { 329 function FileFilter(metadataCache) {
331 /** 330 /**
332 * @type {MetadataCache} 331 * @type {MetadataCache}
333 * @private 332 * @private
334 */ 333 */
335 this.metadataCache_ = metadataCache; 334 this.metadataCache_ = metadataCache;
336 335
337 /** 336 /**
338 * @type Object.<string, Function> 337 * @type Object.<string, Function>
339 * @private 338 * @private
340 */ 339 */
341 this.filters_ = {}; 340 this.filters_ = {};
342 this.setFilterHidden(!showHidden);
343 341
344 // Do not show entries marked as 'deleted'. 342 // Do not show entries marked as 'deleted'.
345 this.addFilter('deleted', function(entry) { 343 this.addFilter('deleted', function(entry) {
346 var internal = this.metadataCache_.getCached(entry, 'internal'); 344 var internal = this.metadataCache_.getCached(entry, 'internal');
347 return !(internal && internal.deleted); 345 return !(internal && internal.deleted);
348 }.bind(this)); 346 }.bind(this));
349 } 347 }
350 348
351 /* 349 /*
352 * FileFilter extends cr.EventTarget. 350 * FileFilter extends cr.EventTarget.
(...skipping 12 matching lines...) Expand all
365 363
366 /** 364 /**
367 * @param {string} name Filter identifier. 365 * @param {string} name Filter identifier.
368 */ 366 */
369 FileFilter.prototype.removeFilter = function(name) { 367 FileFilter.prototype.removeFilter = function(name) {
370 delete this.filters_[name]; 368 delete this.filters_[name];
371 cr.dispatchSimpleEvent(this, 'changed'); 369 cr.dispatchSimpleEvent(this, 'changed');
372 }; 370 };
373 371
374 /** 372 /**
375 * @param {boolean} value If do not show hidden files.
376 */
377 FileFilter.prototype.setFilterHidden = function(value) {
378 if (value) {
379 this.addFilter(
380 'hidden',
381 function(entry) { return entry.name.substr(0, 1) !== '.'; }
382 );
383 } else {
384 this.removeFilter('hidden');
385 }
386 };
387
388 /**
389 * @return {boolean} If the files with names starting with "." are not shown.
390 */
391 FileFilter.prototype.isFilterHiddenOn = function() {
392 return 'hidden' in this.filters_;
393 };
394
395 /**
396 * @param {Entry} entry File entry. 373 * @param {Entry} entry File entry.
397 * @return {boolean} True if the file should be shown, false otherwise. 374 * @return {boolean} True if the file should be shown, false otherwise.
398 */ 375 */
399 FileFilter.prototype.filter = function(entry) { 376 FileFilter.prototype.filter = function(entry) {
400 for (var name in this.filters_) { 377 for (var name in this.filters_) {
401 if (!this.filters_[name](entry)) 378 if (!this.filters_[name](entry))
402 return false; 379 return false;
403 } 380 }
404 return true; 381 return true;
405 }; 382 };
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 context, fakeDirectoryEntry, driveDirectoryEntry, query, searchType) { 742 context, fakeDirectoryEntry, driveDirectoryEntry, query, searchType) {
766 return new DirectoryContents( 743 return new DirectoryContents(
767 context, 744 context,
768 true, // Search 745 true, // Search
769 fakeDirectoryEntry, 746 fakeDirectoryEntry,
770 driveDirectoryEntry, 747 driveDirectoryEntry,
771 function() { 748 function() {
772 return new DriveMetadataSearchContentScanner(query, searchType); 749 return new DriveMetadataSearchContentScanner(query, searchType);
773 }); 750 });
774 }; 751 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/foreground/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698