| 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 // If directory files changes too often, don't rescan directory more than once | 5 // If directory files changes too often, don't rescan directory more than once |
| 6 // per specified interval | 6 // per specified interval |
| 7 const SIMULTANEOUS_RESCAN_INTERVAL = 1000; | 7 const SIMULTANEOUS_RESCAN_INTERVAL = 1000; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Data model of the file manager. | 10 * Data model of the file manager. |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 groups.downloads = [entry]; | 756 groups.downloads = [entry]; |
| 757 done(); | 757 done(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 function onDownloadsError(error) { | 760 function onDownloadsError(error) { |
| 761 groups.downloads = []; | 761 groups.downloads = []; |
| 762 done(); | 762 done(); |
| 763 } | 763 } |
| 764 | 764 |
| 765 function onGData(entry) { | 765 function onGData(entry) { |
| 766 console.log('onGData'); |
| 767 console.log(entry); |
| 766 groups.gdata = [entry]; | 768 groups.gdata = [entry]; |
| 767 done(); | 769 done(); |
| 768 } | 770 } |
| 769 | 771 |
| 770 function onGDataError(error) { | 772 function onGDataError(error) { |
| 773 console.log('onGDataError'); |
| 774 console.log(error); |
| 771 groups.gdata = []; | 775 groups.gdata = []; |
| 772 done(); | 776 done(); |
| 773 } | 777 } |
| 774 | 778 |
| 775 var root = this.root_; | 779 var root = this.root_; |
| 776 root.getDirectory(DirectoryModel.DOWNLOADS_DIRECTORY, { create: false }, | 780 root.getDirectory(DirectoryModel.DOWNLOADS_DIRECTORY, { create: false }, |
| 777 onDownloads, onDownloadsError); | 781 onDownloads, onDownloadsError); |
| 778 util.readDirectory(root, DirectoryModel.ARCHIVE_DIRECTORY, | 782 util.readDirectory(root, DirectoryModel.ARCHIVE_DIRECTORY, |
| 779 append.bind(this, 'archives')); | 783 append.bind(this, 'archives')); |
| 780 util.readDirectory(root, DirectoryModel.REMOVABLE_DIRECTORY, | 784 util.readDirectory(root, DirectoryModel.REMOVABLE_DIRECTORY, |
| 781 append.bind(this, 'removables')); | 785 append.bind(this, 'removables')); |
| 782 root.getDirectory(DirectoryModel.GDATA_DIRECTORY, { create: false }, | 786 root.getDirectory(DirectoryModel.GDATA_DIRECTORY, { create: false }, |
| 783 onGData, onGDataError); | 787 onGData, onGDataError); |
| 784 }, | 788 }, |
| 785 | 789 |
| 786 updateRoots: function(opt_callback) { | 790 updateRoots: function(opt_callback) { |
| 791 console.log('directoryModel_.updateRoots'); |
| 787 var self = this; | 792 var self = this; |
| 788 this.resolveRoots_(function(rootEntries) { | 793 this.resolveRoots_(function(rootEntries) { |
| 794 console.log('rootsList_ = '); |
| 795 console.log(self.rootsList_); |
| 789 var dm = self.rootsList_; | 796 var dm = self.rootsList_; |
| 790 var args = [0, dm.length].concat(rootEntries); | 797 var args = [0, dm.length].concat(rootEntries); |
| 791 dm.splice.apply(dm, args); | 798 dm.splice.apply(dm, args); |
| 792 | 799 |
| 793 self.updateRootsListSelection_(); | 800 self.updateRootsListSelection_(); |
| 794 | 801 |
| 795 if (opt_callback) | 802 if (opt_callback) |
| 796 opt_callback(); | 803 opt_callback(); |
| 797 }); | 804 }); |
| 798 }, | 805 }, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 | 943 |
| 937 recordMetrics_: function() { | 944 recordMetrics_: function() { |
| 938 metrics.recordInterval('DirectoryScan'); | 945 metrics.recordInterval('DirectoryScan'); |
| 939 if (this.dir_.fullPath == | 946 if (this.dir_.fullPath == |
| 940 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { | 947 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { |
| 941 metrics.recordMediumCount("DownloadsCount", this.list_.length); | 948 metrics.recordMediumCount("DownloadsCount", this.list_.length); |
| 942 } | 949 } |
| 943 } | 950 } |
| 944 }; | 951 }; |
| 945 | 952 |
| OLD | NEW |