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

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

Issue 10736024: Revert 146038 as it might have broken chromeos browser_tests - Make eventArgumentMassagers asynchro… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
===================================================================
--- chrome/renderer/resources/extensions/experimental.app_custom_bindings.js (revision 146077)
+++ chrome/renderer/resources/extensions/experimental.app_custom_bindings.js (working copy)
@@ -11,52 +11,52 @@
var DeserializeString = appNatives.DeserializeString;
var CreateBlob = appNatives.CreateBlob;
-chromeHidden.Event.registerArgumentMassager('experimental.app.onLaunched',
- function(args, dispatch) {
- var launchData = args[0];
- var intentData = args[1];
-
- if (launchData && intentData) {
- switch(intentData.format) {
- case('fileEntry'):
- var fs = GetIsolatedFileSystem(intentData.fileSystemId);
- try {
- fs.root.getFile(intentData.baseName, {}, function(fileEntry) {
- launchData.intent.data = fileEntry;
- launchData.intent.postResult = function() {};
- launchData.intent.postFailure = function() {};
- dispatch([launchData]);
- }, function(fileError) {
- console.error('Error getting fileEntry, code: ' + fileError.code);
- dispatch([]);
- });
- } catch (e) {
- console.error('Error in event handler for onLaunched: ' + e.stack);
- dispatch([]);
- }
- break;
- case('serialized'):
- var deserializedData = DeserializeString(intentData.data);
- launchData.intent.data = deserializedData;
- launchData.intent.postResult = function() {};
- launchData.intent.postFailure = function() {};
- dispatch([launchData]);
- break;
- case('blob'):
- var blobData = CreateBlob(intentData.blobFilePath,
- intentData.blobLength);
- launchData.intent.data = blobData;
- launchData.intent.postResult = function() {};
- launchData.intent.postFailure = function() {};
- dispatch([launchData]);
- break;
- default:
- console.error('Unexpected launch data format');
- dispatch([]);
+chromeHidden.registerCustomHook('experimental.app', function(bindingsAPI) {
+ chrome.experimental.app.onLaunched.dispatch =
+ function(launchData, intentData) {
+ if (launchData && intentData) {
+ switch(intentData.format) {
+ case('fileEntry'):
+ var event = this;
+ var fs = GetIsolatedFileSystem(intentData.fileSystemId);
+ try {
+ fs.root.getFile(intentData.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);
+ }
+ break;
+ case('serialized'):
+ var deserializedData = DeserializeString(intentData.data);
+ launchData.intent.data = deserializedData;
+ launchData.intent.postResult = function() {};
+ launchData.intent.postFailure = function() {};
+ chrome.Event.prototype.dispatch.call(this, launchData);
+ break;
+ case('blob'):
+ var blobData = CreateBlob(intentData.blobFilePath,
+ intentData.blobLength);
+ launchData.intent.data = blobData;
+ launchData.intent.postResult = function() {};
+ launchData.intent.postFailure = function() {};
+ chrome.Event.prototype.dispatch.call(this, launchData);
+ break;
+ default:
+ console.error('Unexpected launch data format');
+ chrome.Event.prototype.dispatch.call(this);
+ }
+ } else if (launchData) {
+ chrome.Event.prototype.dispatch.call(this, launchData);
+ } else {
+ chrome.Event.prototype.dispatch.call(this);
}
- } else if (launchData) {
- dispatch([launchData]);
- } else {
- dispatch([]);
- }
+ };
});
« no previous file with comments | « chrome/renderer/resources/extensions/event.js ('k') | chrome/renderer/resources/extensions/input.ime_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698