| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 this.lastChunkReceived(); | 820 this.lastChunkReceived(); |
| 821 return; | 821 return; |
| 822 } | 822 } |
| 823 this.done_ = true; | 823 this.done_ = true; |
| 824 | 824 |
| 825 var entries = results.map(function(r) { return r.entry; }); | 825 var entries = results.map(function(r) { return r.entry; }); |
| 826 this.onNewEntries(entries); | 826 this.onNewEntries(entries); |
| 827 this.lastChunkReceived(); | 827 this.lastChunkReceived(); |
| 828 }).bind(this); | 828 }).bind(this); |
| 829 | 829 |
| 830 var types = 'ALL'; | 830 var types; |
| 831 switch (this.searchType_) { | 831 switch (this.searchType_) { |
| 832 case DirectoryContentsDriveSearchMetadata.SearchType.SEARCH_ALL: | 832 case DirectoryContentsDriveSearchMetadata.SearchType.SEARCH_ALL: |
| 833 types = 'ALL'; | 833 types = 'ALL'; |
| 834 break; | 834 break; |
| 835 case DirectoryContentsDriveSearchMetadata.SearchType.SEARCH_SHARED_WITH_ME: | 835 case DirectoryContentsDriveSearchMetadata.SearchType.SEARCH_SHARED_WITH_ME: |
| 836 types = 'SHARED_WITH_ME'; | 836 types = 'SHARED_WITH_ME'; |
| 837 break; |
| 838 default: |
| 839 throw Error('Unknown search type: ' + this.searchType_); |
| 837 } | 840 } |
| 838 // TODO(haruki): Pass the search type when searchDriveMetadata support is | 841 var searchParams = { |
| 839 // implemented. | 842 'query': this.query_, |
| 840 // var searchParams = { | 843 'types': types, |
| 841 // 'query': this.query_, | 844 'maxResults': 500 |
| 842 // 'types': types, | 845 }; |
| 843 // 'maxResults': 500, | 846 chrome.fileBrowserPrivate.searchDriveMetadata(searchParams, searchCallback); |
| 844 // }; | |
| 845 chrome.fileBrowserPrivate.searchDriveMetadata(this.query_, searchCallback); | |
| 846 }; | 847 }; |
| 847 | 848 |
| 848 /** | 849 /** |
| 849 * DirectoryContents to list Drive files available offline. The search is done | 850 * DirectoryContents to list Drive files available offline. The search is done |
| 850 * by traversing the directory tree under "My Drive" and filtering them using | 851 * by traversing the directory tree under "My Drive" and filtering them using |
| 851 * the availableOffline property in 'drive' metadata. | 852 * the availableOffline property in 'drive' metadata. |
| 852 * @param {FileListContext} context File list context. | 853 * @param {FileListContext} context File list context. |
| 853 * @param {DirectoryEntry} driveDirEntry Directory for actual Drive. Traversal | 854 * @param {DirectoryEntry} driveDirEntry Directory for actual Drive. Traversal |
| 854 * starts from this Entry. Should be null if underlying Drive is not | 855 * starts from this Entry. Should be null if underlying Drive is not |
| 855 * available. | 856 * available. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 }.bind(this); | 987 }.bind(this); |
| 987 | 988 |
| 988 getNextChunk(); | 989 getNextChunk(); |
| 989 }; | 990 }; |
| 990 | 991 |
| 991 /** | 992 /** |
| 992 * Everything is done in scanDirectory_(). | 993 * Everything is done in scanDirectory_(). |
| 993 */ | 994 */ |
| 994 DirectoryContentsDriveOffline.prototype.readNextChunk = function() { | 995 DirectoryContentsDriveOffline.prototype.readNextChunk = function() { |
| 995 }; | 996 }; |
| OLD | NEW |