Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: ui/file_manager/gallery/js/gallery.js

Issue 921043004: [Gallery app] Make the background page use BackgroundBase class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /** 5 /**
6 * Overrided metadata worker's path. 6 * Overrided metadata worker's path.
7 * @type {string} 7 * @type {string}
8 */ 8 */
9 ContentProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; 9 ContentProvider.WORKER_SCRIPT = '/js/metadata_worker.js';
10 10
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 Gallery.prototype.debugMe = function() { 896 Gallery.prototype.debugMe = function() {
897 this.mosaicMode_.debugMe(); 897 this.mosaicMode_.debugMe();
898 }; 898 };
899 899
900 /** 900 /**
901 * Singleton gallery. 901 * Singleton gallery.
902 * @type {Gallery} 902 * @type {Gallery}
903 */ 903 */
904 var gallery = null; 904 var gallery = null;
905 905
906 var loadTimeDataPromise = new Promise(function(fulfill, reject) {
907 chrome.fileManagerPrivate.getStrings(function(strings) {
908 window.loadTimeData.data = strings;
909 i18nTemplate.process(document, loadTimeData);
910 fulfill();
911 });
912 });
913
906 /** 914 /**
907 * Initialize the window. 915 * Initialize the window.
908 * @param {!BackgroundComponents} backgroundComponents Background components. 916 * @param {!BackgroundComponents} backgroundComponents Background components.
fukino 2015/02/16 04:16:38 nit: This comment looks incorrect.
yoshiki 2015/02/16 07:35:55 Done.
909 */ 917 */
910 window.initialize = function(backgroundComponents) { 918 var volumeManagerPromise = new Promise(function(fulfill, reject) {
911 window.loadTimeData.data = backgroundComponents.stringData; 919 var volumeManager = new VolumeManagerWrapper(
912 gallery = new Gallery(backgroundComponents.volumeManager); 920 VolumeManagerWrapper.DriveEnabledStatus.DRIVE_ENABLED);
913 }; 921 volumeManager.ensureInitialized(fulfill.bind(null, volumeManager));
922 });
923
924 var initializePromise =
925 Promise.all([loadTimeDataPromise, volumeManagerPromise]).
926 then(function(args) {
927 var volumeManager = args[1];
928 var gallery = new Gallery(volumeManager);
929 return gallery;
930 });
914 931
915 /** 932 /**
916 * Loads entries. 933 * Loads entries.
917 * @param {!Array.<Entry>} selectedEntries Array of selected entries. 934 * @param {!Array.<Entry>} selectedEntries Array of selected entries.
fukino 2015/02/16 04:16:38 ditto
yoshiki 2015/02/16 07:35:55 Done.
918 */ 935 */
919 window.loadEntries = function(selectedEntries) { 936 initializePromise.then(function(gallery) {
920 gallery.load(selectedEntries); 937 util.URLsToEntries(window.appState.urls, function(entries) {
921 }; 938 gallery.load(entries);
939 });
940 });
922 941
923 /** 942 /**
924 * Enteres the debug mode. 943 * Enteres the debug mode.
925 */ 944 */
926 window.debugMe = function() { 945 window.debugMe = function() {
927 gallery.debugMe(); 946 initializePromise.then(function(gallery) {
947 gallery.debugMe();
948 });
928 }; 949 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698