1 // Copyright 2014 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 binding for the developerPrivate API. 6 7 var binding = require('binding').Binding.create('developerPrivate'); 8 9 binding.registerCustomHook(function(bindingsAPI) { 10 var apiFunctions = bindingsAPI.apiFunctions; 11 12 // Converts the argument of |functionName| from DirectoryEntry to URL. 13 function bindFileSystemFunction(functionName) { 14 apiFunctions.setUpdateArgumentsPostValidate( 15 functionName, function(directoryEntry, callback) { 16 var fileSystemName = directoryEntry.filesystem.name; 17 var relativePath = $String.slice(directoryEntry.fullPath, 1); 18 var url = directoryEntry.toURL(); 19 return [fileSystemName, relativePath, url, callback]; 20 }); 21 } 22 23 bindFileSystemFunction('loadDirectory'); 24 25 }); 26 27 exports.binding = binding.generate(); 28