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