| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Custom bindings for the syncFileSystem API. | 5 // Custom bindings for the syncFileSystem API. |
| 6 | 6 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var Bindings = require('schema_binding_generator').Bindings; |
| 8 var bindings = new Bindings('syncFileSystem'); |
| 9 |
| 8 var syncFileSystemNatives = requireNative('sync_file_system'); | 10 var syncFileSystemNatives = requireNative('sync_file_system'); |
| 9 | 11 |
| 10 chromeHidden.registerCustomHook('syncFileSystem', function(bindingsAPI) { | 12 bindings.registerCustomHook('syncFileSystem', function(bindingsAPI) { |
| 11 var apiFunctions = bindingsAPI.apiFunctions; | 13 var apiFunctions = bindingsAPI.apiFunctions; |
| 12 | 14 |
| 13 // Functions which take in an [instanceOf=FileEntry]. | 15 // Functions which take in an [instanceOf=FileEntry]. |
| 14 function bindFileEntryFunction(functionName) { | 16 function bindFileEntryFunction(functionName) { |
| 15 apiFunctions.setUpdateArgumentsPostValidate( | 17 apiFunctions.setUpdateArgumentsPostValidate( |
| 16 functionName, function(entry, callback) { | 18 functionName, function(entry, callback) { |
| 17 var fileSystemUrl = entry.toURL(); | 19 var fileSystemUrl = entry.toURL(); |
| 18 return [fileSystemUrl, callback]; | 20 return [fileSystemUrl, callback]; |
| 19 }); | 21 }); |
| 20 } | 22 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 var result = null; | 40 var result = null; |
| 39 if (response) { | 41 if (response) { |
| 40 result = syncFileSystemNatives.GetSyncFileSystemObject( | 42 result = syncFileSystemNatives.GetSyncFileSystemObject( |
| 41 response.name, response.root); | 43 response.name, response.root); |
| 42 } | 44 } |
| 43 if (request.callback) | 45 if (request.callback) |
| 44 request.callback(result); | 46 request.callback(result); |
| 45 request.callback = null; | 47 request.callback = null; |
| 46 }); | 48 }); |
| 47 }); | 49 }); |
| 50 |
| 51 exports.bindings = bindings.generate(); |
| OLD | NEW |