| 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 // If directory files changes too often, don't rescan directory more than once | 7 // If directory files changes too often, don't rescan directory more than once |
| 8 // per specified interval | 8 // per specified interval |
| 9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; | 9 var SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
| 10 // Used for operations that require almost instant rescan. | 10 // Used for operations that require almost instant rescan. |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 onClearSearch) { | 836 onClearSearch) { |
| 837 this.clearSearch_(); | 837 this.clearSearch_(); |
| 838 var currentDirEntry = this.getCurrentDirEntry(); | 838 var currentDirEntry = this.getCurrentDirEntry(); |
| 839 if (!currentDirEntry) { | 839 if (!currentDirEntry) { |
| 840 // Not yet initialized. Do nothing. | 840 // Not yet initialized. Do nothing. |
| 841 return; | 841 return; |
| 842 } | 842 } |
| 843 | 843 |
| 844 if (!(query || '').trimLeft()) { | 844 if (!(query || '').trimLeft()) { |
| 845 if (this.isSearching()) { | 845 if (this.isSearching()) { |
| 846 var newDirContents = DirectoryContents.createForDirectory( | 846 var newDirContents = this.createDirectoryContents_( |
| 847 this.currentFileListContext_, | 847 this.currentFileListContext_, |
| 848 currentDirEntry); | 848 currentDirEntry); |
| 849 this.clearAndScan_(newDirContents); | 849 this.clearAndScan_(newDirContents); |
| 850 } | 850 } |
| 851 return; | 851 return; |
| 852 } | 852 } |
| 853 | 853 |
| 854 var newDirContents = this.createDirectoryContents_( | 854 var newDirContents = this.createDirectoryContents_( |
| 855 this.currentFileListContext_, currentDirEntry, query); | 855 this.currentFileListContext_, currentDirEntry, query); |
| 856 if (!newDirContents) | 856 if (!newDirContents) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 874 if (this.onSearchCompleted_) { | 874 if (this.onSearchCompleted_) { |
| 875 this.removeEventListener('scan-completed', this.onSearchCompleted_); | 875 this.removeEventListener('scan-completed', this.onSearchCompleted_); |
| 876 this.onSearchCompleted_ = null; | 876 this.onSearchCompleted_ = null; |
| 877 } | 877 } |
| 878 | 878 |
| 879 if (this.onClearSearch_) { | 879 if (this.onClearSearch_) { |
| 880 this.onClearSearch_(); | 880 this.onClearSearch_(); |
| 881 this.onClearSearch_ = null; | 881 this.onClearSearch_ = null; |
| 882 } | 882 } |
| 883 }; | 883 }; |
| OLD | NEW |