| 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 binding for the syncFileSystem API. |
| 6 |
| 7 var binding = require('binding').Binding.create('syncFileSystem'); |
| 6 | 8 |
| 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 9 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
| 8 var fileSystemNatives = requireNative('file_system_natives'); | 10 var fileSystemNatives = requireNative('file_system_natives'); |
| 9 var syncFileSystemNatives = requireNative('sync_file_system'); | 11 var syncFileSystemNatives = requireNative('sync_file_system'); |
| 10 | 12 |
| 11 chromeHidden.registerCustomHook('syncFileSystem', function(bindingsAPI) { | 13 binding.registerCustomHook(function(bindingsAPI) { |
| 12 var apiFunctions = bindingsAPI.apiFunctions; | 14 var apiFunctions = bindingsAPI.apiFunctions; |
| 13 | 15 |
| 14 // Functions which take in an [instanceOf=FileEntry]. | 16 // Functions which take in an [instanceOf=FileEntry]. |
| 15 function bindFileEntryFunction(functionName) { | 17 function bindFileEntryFunction(functionName) { |
| 16 apiFunctions.setUpdateArgumentsPostValidate( | 18 apiFunctions.setUpdateArgumentsPostValidate( |
| 17 functionName, function(entry, callback) { | 19 functionName, function(entry, callback) { |
| 18 var fileSystemUrl = entry.toURL(); | 20 var fileSystemUrl = entry.toURL(); |
| 19 return [fileSystemUrl, callback]; | 21 return [fileSystemUrl, callback]; |
| 20 }); | 22 }); |
| 21 } | 23 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Combine into a single dictionary. | 62 // Combine into a single dictionary. |
| 61 var fileInfo = new Object(); | 63 var fileInfo = new Object(); |
| 62 fileInfo.fileEntry = fileEntry; | 64 fileInfo.fileEntry = fileEntry; |
| 63 fileInfo.status = args[4]; | 65 fileInfo.status = args[4]; |
| 64 if (fileInfo.status == "synced") { | 66 if (fileInfo.status == "synced") { |
| 65 fileInfo.action = args[5]; | 67 fileInfo.action = args[5]; |
| 66 fileInfo.direction = args[6]; | 68 fileInfo.direction = args[6]; |
| 67 } | 69 } |
| 68 dispatch([fileInfo]); | 70 dispatch([fileInfo]); |
| 69 }); | 71 }); |
| 72 |
| 73 exports.binding = binding.generate(); |
| OLD | NEW |