OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Called from the main frame when unloading. | 8 * Called from the main frame when unloading. |
9 * @param {boolean=} opt_exiting True if the app is exiting. | 9 * @param {boolean=} opt_exiting True if the app is exiting. |
10 */ | 10 */ |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 */ | 853 */ |
854 Gallery.prototype.updateButtons_ = function() { | 854 Gallery.prototype.updateButtons_ = function() { |
855 if (this.modeButton_) { | 855 if (this.modeButton_) { |
856 var oppositeMode = | 856 var oppositeMode = |
857 this.currentMode_ === this.slideMode_ ? this.mosaicMode_ : | 857 this.currentMode_ === this.slideMode_ ? this.mosaicMode_ : |
858 this.slideMode_; | 858 this.slideMode_; |
859 this.modeButton_.title = str(oppositeMode.getTitle()); | 859 this.modeButton_.title = str(oppositeMode.getTitle()); |
860 } | 860 } |
861 }; | 861 }; |
862 | 862 |
863 window.addEventListener('load', function() { | 863 /** |
864 Promise.all([ | 864 * Singleton gallery. |
865 window.backgroundComponentsPromise, | 865 * @type {Gallery} |
866 window.launchData.entriesPromise | 866 */ |
867 ]).then(function(args) { | 867 var gallery = null; |
868 var backgroundComponents = args[0]; | 868 |
869 var entries = args[1]; | 869 /** |
870 window.loadTimeData.data = backgroundComponents.stringData; | 870 * Initialize the window. |
871 var gallery = new Gallery(backgroundComponents.volumeManager); | 871 * @param {Object} backgroundComponents Background components. |
872 gallery.load(entries.allEntries, entries.selectedEntries); | 872 */ |
873 }).catch(function(error) { | 873 window.initialize = function(backgroundComponents) { |
874 console.error(error.stack || error); | 874 window.loadTimeData.data = backgroundComponents.stringData; |
875 }); | 875 gallery = new Gallery(backgroundComponents.volumeManager); |
876 }); | 876 }; |
| 877 |
| 878 /** |
| 879 * Loads entries. |
| 880 */ |
| 881 window.loadEntries = function(entries, selectedEntries) { |
| 882 gallery.load(entries, selectedEntries); |
| 883 }; |
OLD | NEW |