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

Side by Side 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: Compile fixed, postResult added 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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, file_system_id, base_name) {
Mihai Parparita -not on Chrome 2012/05/18 04:26:04 Nit: JS naming style is to use camelCase for varia
benwells 2012/05/22 13:15:03 Done.
14 if (launchData) {
15 event = this;
16 fs = GetIsolatedFileSystem(file_system_id);
17 try {
18 fs.root.getFile(base_name, {}, function(fileEntry) {
19 launchData.intent.data = fileEntry;
20 launchData.intent.postResult = function() {};
21 chrome.Event.prototype.dispatch.apply(event, [launchData]);
Mihai Parparita -not on Chrome 2012/05/18 04:26:04 Nit: if you use .call(), you can pass the argument
benwells 2012/05/22 13:15:03 Done.
22 }, function(fileError) {
23 console.error('Error getting fileEntry, code: ' + fileError.code);
24 chrome.Event.prototype.dispatch.apply(event, []);
25 });
26 } catch (e) {
27 console.error('Error in event handler for onLaunched: ' + e.stack);
28 chrome.Event.prototype.dispatch.apply(event, []);
29 }
30 } else {
31 chrome.Event.prototype.dispatch.apply(this, []);
32 }
33 };
34 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698