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 /** | 7 /** |
8 * This class manages filters and determines a file should be shown or not. | 8 * This class manages filters and determines a file should be shown or not. |
9 * When filters are changed, a 'changed' event is fired. | 9 * When filters are changed, a 'changed' event is fired. |
10 * | 10 * |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 this.reloadMetadata([newEntry], function() { | 428 this.reloadMetadata([newEntry], function() { |
429 successCallback(newEntry); | 429 successCallback(newEntry); |
430 }); | 430 }); |
431 }; | 431 }; |
432 | 432 |
433 this.entry_.getDirectory(name, {create: true, exclusive: true}, | 433 this.entry_.getDirectory(name, {create: true, exclusive: true}, |
434 onSuccess.bind(this), errorCallback); | 434 onSuccess.bind(this), errorCallback); |
435 }; | 435 }; |
436 | 436 |
437 /** | 437 /** |
438 * List of search types for DirectoryContentsDriveSearch. | |
439 * SEARCH_FULL uses the full feed to search from everything. | |
440 * SEARCH_SHARED_WITH_ME uses the shared-with-me feed. | |
441 * @enum {number} | |
442 */ | |
443 DirectoryContentsDriveSearch.SearchType = { | |
444 SEARCH_FULL: 0, | |
445 SEARCH_SHARED_WITH_ME: 1 | |
446 }; | |
447 | |
448 /** | |
449 * Delay to be used for drive search scan. | 438 * Delay to be used for drive search scan. |
450 * The goal is to reduce the number of server requests when user is typing the | 439 * The goal is to reduce the number of server requests when user is typing the |
451 * query. | 440 * query. |
452 * | 441 * |
453 * @type {number} | 442 * @type {number} |
454 * @const | 443 * @const |
455 */ | 444 */ |
456 DirectoryContentsDriveSearch.SCAN_DELAY = 200; | 445 DirectoryContentsDriveSearch.SCAN_DELAY = 200; |
457 | 446 |
458 /** | 447 /** |
459 * Maximum number of results which is shown on the search. | 448 * Maximum number of results which is shown on the search. |
460 * | 449 * |
461 * @type {number} | 450 * @type {number} |
462 * @const | 451 * @const |
463 */ | 452 */ |
464 DirectoryContentsDriveSearch.MAX_RESULTS = 100; | 453 DirectoryContentsDriveSearch.MAX_RESULTS = 100; |
465 | 454 |
466 /** | 455 /** |
467 * @param {FileListContext} context File list context. | 456 * @param {FileListContext} context File list context. |
468 * @param {DirectoryEntry} dirEntry Current directory. | 457 * @param {DirectoryEntry} dirEntry Current directory. |
469 * @param {DirectoryEntry} previousDirEntry DirectoryEntry that was current | 458 * @param {DirectoryEntry} previousDirEntry DirectoryEntry that was current |
470 * before the search. | 459 * before the search. |
471 * @param {string} query Search query. | 460 * @param {string} query Search query. |
472 * @param {DirectoryContentsDriveSearch.SearchType} type Type of search. | |
473 * @constructor | 461 * @constructor |
474 * @extends {DirectoryContents} | 462 * @extends {DirectoryContents} |
475 */ | 463 */ |
476 function DirectoryContentsDriveSearch(context, | 464 function DirectoryContentsDriveSearch(context, |
477 dirEntry, | 465 dirEntry, |
478 previousDirEntry, | 466 previousDirEntry, |
479 query, | 467 query) { |
480 type) { | |
481 DirectoryContents.call(this, context); | 468 DirectoryContents.call(this, context); |
482 this.query_ = query; | |
483 this.type_ = type; | |
484 this.directoryEntry_ = dirEntry; | 469 this.directoryEntry_ = dirEntry; |
485 this.previousDirectoryEntry_ = previousDirEntry; | 470 this.previousDirectoryEntry_ = previousDirEntry; |
| 471 this.query_ = query; |
486 this.nextFeed_ = ''; | 472 this.nextFeed_ = ''; |
487 this.done_ = false; | 473 this.done_ = false; |
488 this.fetchedResultsNum_ = 0; | 474 this.fetchedResultsNum_ = 0; |
489 } | 475 } |
490 | 476 |
491 /** | 477 /** |
492 * Extends DirectoryContents. | 478 * Extends DirectoryContents. |
493 */ | 479 */ |
494 DirectoryContentsDriveSearch.prototype.__proto__ = DirectoryContents.prototype; | 480 DirectoryContentsDriveSearch.prototype.__proto__ = DirectoryContents.prototype; |
495 | 481 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 }.bind(this); | 971 }.bind(this); |
986 | 972 |
987 getNextChunk(); | 973 getNextChunk(); |
988 }; | 974 }; |
989 | 975 |
990 /** | 976 /** |
991 * Everything is done in scanDirectory_(). | 977 * Everything is done in scanDirectory_(). |
992 */ | 978 */ |
993 DirectoryContentsDriveOffline.prototype.readNextChunk = function() { | 979 DirectoryContentsDriveOffline.prototype.readNextChunk = function() { |
994 }; | 980 }; |
OLD | NEW |