| Index: chrome/renderer/resources/extensions/experimental.app_custom_bindings.js
|
| diff --git a/chrome/renderer/resources/extensions/experimental.app_custom_bindings.js b/chrome/renderer/resources/extensions/experimental.app_custom_bindings.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..575ca47ddb5a9e5e45536f66a8dbd285c8d81581
|
| --- /dev/null
|
| +++ b/chrome/renderer/resources/extensions/experimental.app_custom_bindings.js
|
| @@ -0,0 +1,35 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Custom bindings for the experimental.app API.
|
| +
|
| +var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
|
| +var experimentalAppNatives = requireNative('experimental_app');
|
| +var GetIsolatedFileSystem = experimentalAppNatives.GetIsolatedFileSystem;
|
| +
|
| +chromeHidden.registerCustomHook('experimental.app', function(bindingsAPI) {
|
| + chrome.experimental.app.onLaunched.dispatch =
|
| + function(launchData, fileSystemId, baseName) {
|
| + if (launchData) {
|
| + event = this;
|
| + fs = GetIsolatedFileSystem(fileSystemId);
|
| + try {
|
| + fs.root.getFile(baseName, {}, function(fileEntry) {
|
| + launchData.intent.data = fileEntry;
|
| + launchData.intent.postResult = function() {};
|
| + launchData.intent.postFailure = function() {};
|
| + chrome.Event.prototype.dispatch.call(event, launchData);
|
| + }, function(fileError) {
|
| + console.error('Error getting fileEntry, code: ' + fileError.code);
|
| + chrome.Event.prototype.dispatch.call(event);
|
| + });
|
| + } catch (e) {
|
| + console.error('Error in event handler for onLaunched: ' + e.stack);
|
| + chrome.Event.prototype.dispatch.call(event);
|
| + }
|
| + } else {
|
| + chrome.Event.prototype.dispatch.call(this);
|
| + }
|
| + };
|
| +});
|
|
|