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 // Stores the app windows OLNY for test purpose. | 7 // Stores the app windows OLNY for test purpose. |
8 // We SHOULD NOT use it as it is except for test, since the files which have | 8 // We SHOULD NOT use it as it is except for test, since the files which have |
9 // the same name will be overridden each other. | 9 // the same name will be overridden each other. |
10 var appWindowsForTest = {}; | 10 var appWindowsForTest = {}; |
11 | 11 |
12 var initializeQueue = new AsyncUtil.Queue(); | 12 var initializeQueue = new AsyncUtil.Queue(); |
13 | 13 |
14 // Initializes the strings. This needs for the volume manager. | 14 // Initializes the strings. This needs for the volume manager. |
15 initializeQueue.run(function(fulfill) { | 15 initializeQueue.run(function(fulfill) { |
16 chrome.fileBrowserPrivate.getStrings(function(stringData) { | 16 chrome.fileManagerPrivate.getStrings(function(stringData) { |
17 loadTimeData.data = stringData; | 17 loadTimeData.data = stringData; |
18 fulfill(); | 18 fulfill(); |
19 }.wrap()); | 19 }.wrap()); |
20 }.wrap()); | 20 }.wrap()); |
21 | 21 |
22 // Initializes the volume manager. This needs for isolated entries. | 22 // Initializes the volume manager. This needs for isolated entries. |
23 initializeQueue.run(function(fulfill) { | 23 initializeQueue.run(function(fulfill) { |
24 VolumeManager.getInstance(fulfill); | 24 VolumeManager.getInstance(fulfill); |
25 }.wrap()); | 25 }.wrap()); |
26 | 26 |
27 chrome.app.runtime.onLaunched.addListener(onLaunched); | 27 chrome.app.runtime.onLaunched.addListener(onLaunched); |
28 | 28 |
29 /** | 29 /** |
30 * Called when an app is launched. | 30 * Called when an app is launched. |
31 * @param {Object} launchData Launch data. | 31 * @param {Object} launchData Launch data. |
32 */ | 32 */ |
33 function onLaunched(launchData) { | 33 function onLaunched(launchData) { |
34 if (!launchData || !launchData.items || launchData.items.length == 0) | 34 if (!launchData || !launchData.items || launchData.items.length == 0) |
35 return; | 35 return; |
36 | 36 |
37 var videos = []; | 37 var videos = []; |
38 | 38 |
39 initializeQueue.run(function(fulfill) { | 39 initializeQueue.run(function(fulfill) { |
40 var isolatedEntries = launchData.items.map(function(item) { | 40 var isolatedEntries = launchData.items.map(function(item) { |
41 return item.entry; | 41 return item.entry; |
42 }); | 42 }); |
43 | 43 |
44 chrome.fileBrowserPrivate.resolveIsolatedEntries(isolatedEntries, | 44 chrome.fileManagerPrivate.resolveIsolatedEntries(isolatedEntries, |
45 function(externalEntries) { | 45 function(externalEntries) { |
46 videos = externalEntries.map(function(entry) { | 46 videos = externalEntries.map(function(entry) { |
47 return Object.freeze({ | 47 return Object.freeze({ |
48 entry: entry, | 48 entry: entry, |
49 title: entry.name, | 49 title: entry.name, |
50 url: entry.toURL(), | 50 url: entry.toURL(), |
51 }); | 51 }); |
52 }); | 52 }); |
53 fulfill(); | 53 fulfill(); |
54 }.wrap()); | 54 }.wrap()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 chrome.runtime.onMessageExternal.addListener(function(message) { | 104 chrome.runtime.onMessageExternal.addListener(function(message) { |
105 if (message.name !== 'testResourceLoaded') | 105 if (message.name !== 'testResourceLoaded') |
106 return; | 106 return; |
107 var script = document.createElement('script'); | 107 var script = document.createElement('script'); |
108 script.src = | 108 script.src = |
109 'chrome-extension://' + window.testExtensionId + | 109 'chrome-extension://' + window.testExtensionId + |
110 '/common/test_loader.js'; | 110 '/common/test_loader.js'; |
111 document.documentElement.appendChild(script); | 111 document.documentElement.appendChild(script); |
112 }); | 112 }); |
113 } | 113 } |
OLD | NEW |