OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 var stringData = new Promise(function(fulfill) { |
| 8 chrome.fileBrowserPrivate.getStrings(function(stringData) { |
| 9 loadTimeData.data = stringData; |
| 10 fulfill(stringData); |
| 11 }); |
| 12 }); |
| 13 |
| 14 // VolumeManager should be obtained after stringData initialized. |
| 15 var volumeManager = stringData.then(function() { |
| 16 return new Promise(function(fulfill) { |
| 17 VolumeManager.getInstance(fulfill); |
| 18 }); |
| 19 }); |
| 20 |
| 21 var backgroundComponent = Promise.all([stringData, volumeManager]). |
| 22 then(function(args) { |
| 23 return { |
| 24 stringData: args[0], |
| 25 volumeManager: args[1] |
| 26 }; |
| 27 }); |
| 28 |
| 29 chrome.app.runtime.onLaunched.addListener(function(launchData) { |
| 30 // Skip if files are not selected. |
| 31 if (!launchData || !launchData.items || launchData.items.length == 0) |
| 32 return; |
| 33 |
| 34 // Open application window. |
| 35 chrome.app.window.create( |
| 36 'gallery.html', |
| 37 { |
| 38 id: 'video', |
| 39 minWidth: 160, |
| 40 minHeight: 100, |
| 41 frame: 'none' |
| 42 }, |
| 43 function(appWindow) { |
| 44 appWindow.contentWindow.launchData = launchData; |
| 45 appWindow.contentWindow.backgroundComponent = backgroundComponent; |
| 46 }); |
| 47 }); |
OLD | NEW |