Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1969)

Unified Diff: chrome/renderer/resources/extensions/experimental.app_custom_bindings.js

Issue 10332071: Pass command line arguments onto platform apps which provide the right intent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Windows tests fixed Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+ }
+ };
+});
« no previous file with comments | « chrome/renderer/renderer_resources.grd ('k') | chrome/test/data/extensions/platform_apps/launch_file/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698