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 * @param {Object.<string, string>} stringData String data. | 8 * @param {Object.<string, string>} stringData String data. |
9 * @param {VolumeManager} volumeManager Volume manager. | 9 * @param {VolumeManager} volumeManager Volume manager. |
10 */ | 10 */ |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 Object.freeze(this); | 24 Object.freeze(this); |
25 } | 25 } |
26 | 26 |
27 /** | 27 /** |
28 * Loads background component. | 28 * Loads background component. |
29 * @return {Promise} Promise fulfilled with BackgroundComponents. | 29 * @return {Promise} Promise fulfilled with BackgroundComponents. |
30 */ | 30 */ |
31 BackgroundComponents.load = function() { | 31 BackgroundComponents.load = function() { |
32 var stringDataPromise = new Promise(function(fulfill) { | 32 var stringDataPromise = new Promise(function(fulfill) { |
33 chrome.fileBrowserPrivate.getStrings(function(stringData) { | 33 chrome.fileManagerPrivate.getStrings(function(stringData) { |
34 loadTimeData.data = stringData; | 34 loadTimeData.data = stringData; |
35 fulfill(stringData); | 35 fulfill(stringData); |
36 }); | 36 }); |
37 }); | 37 }); |
38 | 38 |
39 // VolumeManager should be obtained after stringData initialized. | 39 // VolumeManager should be obtained after stringData initialized. |
40 var volumeManagerPromise = stringDataPromise.then(function() { | 40 var volumeManagerPromise = stringDataPromise.then(function() { |
41 return new Promise(function(fulfill) { | 41 return new Promise(function(fulfill) { |
42 VolumeManager.getInstance(fulfill); | 42 VolumeManager.getInstance(fulfill); |
43 }); | 43 }); |
(...skipping 11 matching lines...) Expand all Loading... |
55 */ | 55 */ |
56 var backgroundComponentsPromise = BackgroundComponents.load(); | 56 var backgroundComponentsPromise = BackgroundComponents.load(); |
57 | 57 |
58 /** | 58 /** |
59 * Resolves file system names and obtains entries. | 59 * Resolves file system names and obtains entries. |
60 * @param {Array.<FileEntry>} entries Names of isolated file system. | 60 * @param {Array.<FileEntry>} entries Names of isolated file system. |
61 * @return {Promise} Promise to be fulfilled with an entry array. | 61 * @return {Promise} Promise to be fulfilled with an entry array. |
62 */ | 62 */ |
63 function resolveEntries(entries) { | 63 function resolveEntries(entries) { |
64 return new Promise(function(fulfill, reject) { | 64 return new Promise(function(fulfill, reject) { |
65 chrome.fileBrowserPrivate.resolveIsolatedEntries(entries, | 65 chrome.fileManagerPrivate.resolveIsolatedEntries(entries, |
66 function(externalEntries) { | 66 function(externalEntries) { |
67 if (!chrome.runtime.lastError) | 67 if (!chrome.runtime.lastError) |
68 fulfill(externalEntries); | 68 fulfill(externalEntries); |
69 else | 69 else |
70 reject(chrome.runtime.lastError); | 70 reject(chrome.runtime.lastError); |
71 }); | 71 }); |
72 }); | 72 }); |
73 } | 73 } |
74 | 74 |
75 /** | 75 /** |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 chrome.runtime.onMessageExternal.addListener(function(message) { | 207 chrome.runtime.onMessageExternal.addListener(function(message) { |
208 if (message.name !== 'testResourceLoaded') | 208 if (message.name !== 'testResourceLoaded') |
209 return; | 209 return; |
210 var script = document.createElement('script'); | 210 var script = document.createElement('script'); |
211 script.src = | 211 script.src = |
212 'chrome-extension://' + window.testExtensionId + | 212 'chrome-extension://' + window.testExtensionId + |
213 '/common/test_loader.js'; | 213 '/common/test_loader.js'; |
214 document.documentElement.appendChild(script); | 214 document.documentElement.appendChild(script); |
215 }); | 215 }); |
216 } | 216 } |
OLD | NEW |