| 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); | |
| 768 groups.gdata = [entry]; | 766 groups.gdata = [entry]; |
| 769 done(); | 767 done(); |
| 770 } | 768 } |
| 771 | 769 |
| 772 function onGDataError(error) { | 770 function onGDataError(error) { |
| 773 console.log('onGDataError'); | |
| 774 console.log(error); | |
| 775 groups.gdata = []; | 771 groups.gdata = []; |
| 776 done(); | 772 done(); |
| 777 } | 773 } |
| 778 | 774 |
| 779 var root = this.root_; | 775 var root = this.root_; |
| 780 root.getDirectory(DirectoryModel.DOWNLOADS_DIRECTORY, { create: false }, | 776 root.getDirectory(DirectoryModel.DOWNLOADS_DIRECTORY, { create: false }, |
| 781 onDownloads, onDownloadsError); | 777 onDownloads, onDownloadsError); |
| 782 util.readDirectory(root, DirectoryModel.ARCHIVE_DIRECTORY, | 778 util.readDirectory(root, DirectoryModel.ARCHIVE_DIRECTORY, |
| 783 append.bind(this, 'archives')); | 779 append.bind(this, 'archives')); |
| 784 util.readDirectory(root, DirectoryModel.REMOVABLE_DIRECTORY, | 780 util.readDirectory(root, DirectoryModel.REMOVABLE_DIRECTORY, |
| 785 append.bind(this, 'removables')); | 781 append.bind(this, 'removables')); |
| 786 root.getDirectory(DirectoryModel.GDATA_DIRECTORY, { create: false }, | 782 root.getDirectory(DirectoryModel.GDATA_DIRECTORY, { create: false }, |
| 787 onGData, onGDataError); | 783 onGData, onGDataError); |
| 788 }, | 784 }, |
| 789 | 785 |
| 790 updateRoots: function(opt_callback) { | 786 updateRoots: function(opt_callback) { |
| 791 console.log('directoryModel_.updateRoots'); | |
| 792 var self = this; | 787 var self = this; |
| 793 this.resolveRoots_(function(rootEntries) { | 788 this.resolveRoots_(function(rootEntries) { |
| 794 console.log('rootsList_ = '); | |
| 795 console.log(self.rootsList_); | |
| 796 var dm = self.rootsList_; | 789 var dm = self.rootsList_; |
| 797 var args = [0, dm.length].concat(rootEntries); | 790 var args = [0, dm.length].concat(rootEntries); |
| 798 dm.splice.apply(dm, args); | 791 dm.splice.apply(dm, args); |
| 799 | 792 |
| 800 self.updateRootsListSelection_(); | 793 self.updateRootsListSelection_(); |
| 801 | 794 |
| 802 if (opt_callback) | 795 if (opt_callback) |
| 803 opt_callback(); | 796 opt_callback(); |
| 804 }); | 797 }); |
| 805 }, | 798 }, |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 | 936 |
| 944 recordMetrics_: function() { | 937 recordMetrics_: function() { |
| 945 metrics.recordInterval('DirectoryScan'); | 938 metrics.recordInterval('DirectoryScan'); |
| 946 if (this.dir_.fullPath == | 939 if (this.dir_.fullPath == |
| 947 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { | 940 '/' + DirectoryModel.DOWNLOADS_DIRECTORY) { |
| 948 metrics.recordMediumCount("DownloadsCount", this.list_.length); | 941 metrics.recordMediumCount("DownloadsCount", this.list_.length); |
| 949 } | 942 } |
| 950 } | 943 } |
| 951 }; | 944 }; |
| 952 | 945 |
| OLD | NEW |