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 // Custom binding for the chrome.app.runtime API. | 5 // Custom binding for the chrome.app.runtime API. |
6 | 6 |
7 var binding = require('binding').Binding.create('app.runtime'); | 7 var binding = require('binding').Binding.create('app.runtime'); |
8 | 8 |
9 var AppViewGuestInternal = | 9 var AppViewGuestInternal = |
10 require('binding').Binding.create('appViewGuestInternal').generate(); | 10 require('binding').Binding.create('appViewGuestInternal').generate(); |
(...skipping 29 matching lines...) Expand all Loading... |
40 // An onLaunched corresponding to file_handlers in the app's manifest. | 40 // An onLaunched corresponding to file_handlers in the app's manifest. |
41 var items = []; | 41 var items = []; |
42 var numItems = launchData.items.length; | 42 var numItems = launchData.items.length; |
43 var itemLoaded = function(err, item) { | 43 var itemLoaded = function(err, item) { |
44 if (err) { | 44 if (err) { |
45 console.error('Error getting fileEntry, code: ' + err.code); | 45 console.error('Error getting fileEntry, code: ' + err.code); |
46 } else { | 46 } else { |
47 $Array.push(items, item); | 47 $Array.push(items, item); |
48 } | 48 } |
49 if (--numItems === 0) { | 49 if (--numItems === 0) { |
50 var data = { isKioskSession: launchData.isKioskSession }; | 50 var data = { |
| 51 isKioskSession: launchData.isKioskSession, |
| 52 source: launchData.source |
| 53 }; |
51 if (items.length !== 0) { | 54 if (items.length !== 0) { |
52 data.id = launchData.id; | 55 data.id = launchData.id; |
53 data.items = items; | 56 data.items = items; |
54 } | 57 } |
55 dispatch([data]); | 58 dispatch([data]); |
56 } | 59 } |
57 }; | 60 }; |
58 $Array.forEach(launchData.items, function(item) { | 61 $Array.forEach(launchData.items, function(item) { |
59 var fs = GetIsolatedFileSystem(item.fileSystemId); | 62 var fs = GetIsolatedFileSystem(item.fileSystemId); |
60 fs.root.getFile(item.baseName, {}, function(fileEntry) { | 63 fs.root.getFile(item.baseName, {}, function(fileEntry) { |
61 entryIdManager.registerEntry(item.entryId, fileEntry); | 64 entryIdManager.registerEntry(item.entryId, fileEntry); |
62 itemLoaded(null, { entry: fileEntry, type: item.mimeType }); | 65 itemLoaded(null, { entry: fileEntry, type: item.mimeType }); |
63 }, function(fileError) { | 66 }, function(fileError) { |
64 itemLoaded(fileError); | 67 itemLoaded(fileError); |
65 }); | 68 }); |
66 }); | 69 }); |
67 } else { | 70 } else { |
68 // Default case. This currently covers an onLaunched corresponding to | 71 // Default case. This currently covers an onLaunched corresponding to |
69 // url_handlers in the app's manifest. | 72 // url_handlers in the app's manifest. |
70 dispatch([launchData]); | 73 dispatch([launchData]); |
71 } | 74 } |
72 }); | 75 }); |
73 | 76 |
74 exports.binding = binding.generate(); | 77 exports.binding = binding.generate(); |
OLD | NEW |