Index: chrome/renderer/resources/extensions/file_system_custom_bindings.js |
diff --git a/chrome/renderer/resources/extensions/file_system_custom_bindings.js b/chrome/renderer/resources/extensions/file_system_custom_bindings.js |
index 29e20e764e3785693efad3ceff44b0c9205dc295..6a3443949f7d4007dcfa5589d4d67e5ea3ce67fd 100644 |
--- a/chrome/renderer/resources/extensions/file_system_custom_bindings.js |
+++ b/chrome/renderer/resources/extensions/file_system_custom_bindings.js |
@@ -2,16 +2,19 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// Custom bindings for the fileSystem API. |
+// Custom binding for the fileSystem API. |
+ |
+var binding = require('binding').Binding.create('fileSystem'); |
-var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
var fileSystemNatives = requireNative('file_system_natives'); |
var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem; |
var lastError = require('lastError'); |
var entryIdManager = require('entryIdManager'); |
-chromeHidden.registerCustomHook('fileSystem', function(bindingsAPI) { |
+binding.registerCustomHook(function(bindingsAPI) { |
var apiFunctions = bindingsAPI.apiFunctions; |
+ var fileSystem = bindingsAPI.compiledApi; |
+ |
function bindFileEntryFunction(functionName) { |
apiFunctions.setUpdateArgumentsPostValidate( |
functionName, function(fileEntry, callback) { |
@@ -44,12 +47,12 @@ chromeHidden.registerCustomHook('fileSystem', function(bindingsAPI) { |
entryIdManager.registerEntry(id, fileEntry); |
callback(fileEntry); |
}, function(fileError) { |
- lastError.set('Error getting fileEntry, code: ' + fileError.code); |
- callback(); |
+ lastError.run('Error getting fileEntry, code: ' + fileError.code, |
+ callback); |
}); |
} catch (e) { |
- lastError.set('Error in event handler for onLaunched: ' + e.stack); |
- callback(); |
+ lastError.run('Error in event handler for onLaunched: ' + e.stack, |
+ callback); |
} |
} |
}); |
@@ -65,21 +68,23 @@ chromeHidden.registerCustomHook('fileSystem', function(bindingsAPI) { |
}); |
// TODO(benwells): Remove these deprecated versions of the functions. |
- chrome.fileSystem.getWritableFileEntry = function() { |
+ fileSystem.getWritableFileEntry = function() { |
console.log("chrome.fileSystem.getWritableFileEntry is deprecated"); |
console.log("Please use chrome.fileSystem.getWritableEntry instead"); |
- chrome.fileSystem.getWritableEntry.apply(this, arguments); |
+ fileSystem.getWritableEntry.apply(this, arguments); |
}; |
- chrome.fileSystem.isWritableFileEntry = function() { |
+ fileSystem.isWritableFileEntry = function() { |
console.log("chrome.fileSystem.isWritableFileEntry is deprecated"); |
console.log("Please use chrome.fileSystem.isWritableEntry instead"); |
- chrome.fileSystem.isWritableEntry.apply(this, arguments); |
+ fileSystem.isWritableEntry.apply(this, arguments); |
}; |
- chrome.fileSystem.chooseFile = function() { |
+ fileSystem.chooseFile = function() { |
console.log("chrome.fileSystem.chooseFile is deprecated"); |
console.log("Please use chrome.fileSystem.chooseEntry instead"); |
- chrome.fileSystem.chooseEntry.apply(this, arguments); |
+ fileSystem.chooseEntry.apply(this, arguments); |
}; |
}); |
+ |
+exports.binding = binding.generate(); |