| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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 // Custom bindings for the experimental.app API. |
| 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var experimentalAppNatives = requireNative('experimental_app'); |
| 9 var GetIsolatedFileSystem = experimentalAppNatives.GetIsolatedFileSystem; |
| 10 |
| 11 chromeHidden.registerCustomHook('experimental.app', function(bindingsAPI) { |
| 12 chrome.experimental.app.onLaunched.dispatch = |
| 13 function(launchData, fileSystemId, baseName) { |
| 14 if (launchData) { |
| 15 event = this; |
| 16 fs = GetIsolatedFileSystem(fileSystemId); |
| 17 try { |
| 18 fs.root.getFile(baseName, {}, function(fileEntry) { |
| 19 launchData.intent.data = fileEntry; |
| 20 launchData.intent.postResult = function() {}; |
| 21 launchData.intent.postFailure = function() {}; |
| 22 chrome.Event.prototype.dispatch.call(event, launchData); |
| 23 }, function(fileError) { |
| 24 console.error('Error getting fileEntry, code: ' + fileError.code); |
| 25 chrome.Event.prototype.dispatch.call(event); |
| 26 }); |
| 27 } catch (e) { |
| 28 console.error('Error in event handler for onLaunched: ' + e.stack); |
| 29 chrome.Event.prototype.dispatch.call(event); |
| 30 } |
| 31 } else { |
| 32 chrome.Event.prototype.dispatch.call(this); |
| 33 } |
| 34 }; |
| 35 }); |
| OLD | NEW |