| 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 // Setting the src of an img to an empty string can crash the browser, so we |     5 // Setting the src of an img to an empty string can crash the browser, so we | 
|     6 // use an empty 1x1 gif instead. |     6 // use an empty 1x1 gif instead. | 
|     7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' |     7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' | 
|     8         + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; |     8         + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; | 
|     9  |     9  | 
|    10 /** |    10 /** | 
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   550     this.summarizeSelection_(); |   550     this.summarizeSelection_(); | 
|   551  |   551  | 
|   552     var sortField = |   552     var sortField = | 
|   553         window.localStorage['sort-field-' + this.dialogType_] || 'cachedMtime_'; |   553         window.localStorage['sort-field-' + this.dialogType_] || 'cachedMtime_'; | 
|   554     var sortDirection = |   554     var sortDirection = | 
|   555         window.localStorage['sort-direction-' + this.dialogType_] || 'desc'; |   555         window.localStorage['sort-direction-' + this.dialogType_] || 'desc'; | 
|   556     this.directoryModel_.fileList.sort(sortField, sortDirection); |   556     this.directoryModel_.fileList.sort(sortField, sortDirection); | 
|   557  |   557  | 
|   558     this.refocus(); |   558     this.refocus(); | 
|   559  |   559  | 
|   560     this.localMetadataProvider_ = this.createLocalMetadataProvider_(); |   560     this.metadataProvider_ = | 
|   561     this.gdataMetadataProvider_ = new GDataMetadataProvider(); |   561         new MetadataProvider(this.filesystem_.root.toURL()); | 
 |   562  | 
 |   563     // PyAuto tests monitor this state by polling this variable | 
 |   564     this.__defineGetter__('workerInitialized_', function() { | 
 |   565        return self.getMetadataProvider().isInitialized(); | 
 |   566     }); | 
|   562  |   567  | 
|   563     this.table_.list.endBatchUpdates(); |   568     this.table_.list.endBatchUpdates(); | 
|   564     this.grid_.endBatchUpdates(); |   569     this.grid_.endBatchUpdates(); | 
|   565  |   570  | 
|   566     metrics.recordInterval('Load.DOM'); |   571     metrics.recordInterval('Load.DOM'); | 
|   567     metrics.recordInterval('Load.Total'); |   572     metrics.recordInterval('Load.Total'); | 
|   568   }; |   573   }; | 
|   569  |   574  | 
|   570   /** |   575   /** | 
|   571    * One-time initialization of commands. |   576    * One-time initialization of commands. | 
| (...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2184       setVisibility('visible'); |  2189       setVisibility('visible'); | 
|  2185       self.onResize_(); |  2190       self.onResize_(); | 
|  2186     } |  2191     } | 
|  2187  |  2192  | 
|  2188     function setVisibility(visibility) { |  2193     function setVisibility(visibility) { | 
|  2189       panel.setAttribute('visibility', visibility); |  2194       panel.setAttribute('visibility', visibility); | 
|  2190     } |  2195     } | 
|  2191   }; |  2196   }; | 
|  2192  |  2197  | 
|  2193  |  2198  | 
|  2194   FileManager.prototype.createLocalMetadataProvider_ = function() { |  | 
|  2195     // Subclass MetadataProvider to notify tests when the initialization |  | 
|  2196     // is complete. |  | 
|  2197  |  | 
|  2198     var fileManager = this; |  | 
|  2199  |  | 
|  2200     function TestAwareMetadataProvider () { |  | 
|  2201       MetadataProvider.apply(this, arguments); |  | 
|  2202     } |  | 
|  2203  |  | 
|  2204     TestAwareMetadataProvider.prototype = { |  | 
|  2205       __proto__: MetadataProvider.prototype, |  | 
|  2206  |  | 
|  2207       onInitialized_: function() { |  | 
|  2208         MetadataProvider.prototype.onInitialized_.apply(this, arguments); |  | 
|  2209  |  | 
|  2210         // We're ready to run.  Tests can monitor for this state with |  | 
|  2211         // ExtensionTestMessageListener listener("worker-initialized"); |  | 
|  2212         // ASSERT_TRUE(listener.WaitUntilSatisfied()); |  | 
|  2213         // Automated tests need to wait for this, otherwise we crash in |  | 
|  2214         // browser_test cleanup because the worker process still has |  | 
|  2215         // URL requests in-flight. |  | 
|  2216         chrome.test.sendMessage('worker-initialized'); |  | 
|  2217         // PyAuto tests monitor this state by polling this variable |  | 
|  2218         fileManager.workerInitialized_ = true; |  | 
|  2219       } |  | 
|  2220     }; |  | 
|  2221  |  | 
|  2222     return new TestAwareMetadataProvider(); |  | 
|  2223   }; |  | 
|  2224  |  | 
|  2225   FileManager.prototype.isOnGData = function() { |  2199   FileManager.prototype.isOnGData = function() { | 
|  2226     return this.directoryModel_ && |  2200     return this.directoryModel_ && | 
|  2227         this.directoryModel_.rootPath == '/' + DirectoryModel.GDATA_DIRECTORY; |  2201         this.directoryModel_.rootPath == '/' + DirectoryModel.GDATA_DIRECTORY; | 
|  2228   }; |  2202   }; | 
|  2229  |  2203  | 
|  2230   FileManager.prototype.getMetadataProvider = function() { |  2204   FileManager.prototype.getMetadataProvider = function() { | 
|  2231     if (this.isOnGData()) |  2205     return this.metadataProvider_; | 
|  2232       return this.gdataMetadataProvider_; |  | 
|  2233     else |  | 
|  2234       return this.localMetadataProvider_; |  | 
|  2235   }; |  2206   }; | 
|  2236  |  2207  | 
|  2237   /** |  2208   /** | 
|  2238    * Callback called when tasks for selected files are determined. |  2209    * Callback called when tasks for selected files are determined. | 
|  2239    * @param {Object} selection Selection is passed here, since this.selection |  2210    * @param {Object} selection Selection is passed here, since this.selection | 
|  2240    *     can change before tasks were found, and we should be accurate. |  2211    *     can change before tasks were found, and we should be accurate. | 
|  2241    * @param {Array.<Task>} tasksList The tasks list. |  2212    * @param {Array.<Task>} tasksList The tasks list. | 
|  2242    */ |  2213    */ | 
|  2243   FileManager.prototype.onTasksFound_ = function(selection, tasksList) { |  2214   FileManager.prototype.onTasksFound_ = function(selection, tasksList) { | 
|  2244     this.taskItems_.clear(); |  2215     this.taskItems_.clear(); | 
| (...skipping 1917 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4162           }); |  4133           }); | 
|  4163       }, onError); |  4134       }, onError); | 
|  4164  |  4135  | 
|  4165       function onError(err) { |  4136       function onError(err) { | 
|  4166         console.log('Error while checking free space: ' + err); |  4137         console.log('Error while checking free space: ' + err); | 
|  4167         setTimeout(doCheck, 1000 * 60); |  4138         setTimeout(doCheck, 1000 * 60); | 
|  4168       } |  4139       } | 
|  4169     } |  4140     } | 
|  4170   } |  4141   } | 
|  4171 })(); |  4142 })(); | 
| OLD | NEW |