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 fileSystem API. | 5 // Custom binding for the fileSystem API. |
6 | 6 |
7 var binding = require('binding').Binding.create('fileSystem'); | 7 var binding = require('binding').Binding.create('fileSystem'); |
8 | 8 |
9 var entryIdManager = require('entryIdManager'); | 9 var entryIdManager = require('entryIdManager'); |
10 var fileSystemNatives = requireNative('file_system_natives'); | 10 var fileSystemNatives = requireNative('file_system_natives'); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 lastError.run('Error in event handler for onLaunched: ' + e.stack, | 54 lastError.run('Error in event handler for onLaunched: ' + e.stack, |
55 callback); | 55 callback); |
56 } | 56 } |
57 } | 57 } |
58 }); | 58 }); |
59 } | 59 } |
60 forEach(['getWritableEntry', 'chooseEntry'], bindFileEntryCallback); | 60 forEach(['getWritableEntry', 'chooseEntry'], bindFileEntryCallback); |
61 | 61 |
62 apiFunctions.setHandleRequest('getEntryId', function(fileEntry) { | 62 apiFunctions.setHandleRequest('getEntryId', function(fileEntry) { |
63 return entryIdManager.getEntryId(fileEntry); | 63 return entryIdManager.getEntryId(fileEntry); |
64 }); | 64 }, false); |
65 | 65 |
66 apiFunctions.setHandleRequest('getEntryById', function(id) { | 66 apiFunctions.setHandleRequest('getEntryById', function(id) { |
67 return entryIdManager.getEntryById(id); | 67 return entryIdManager.getEntryById(id); |
68 }); | 68 }, false); |
69 | 69 |
70 // TODO(benwells): Remove these deprecated versions of the functions. | 70 // TODO(benwells): Remove these deprecated versions of the functions. |
71 fileSystem.getWritableFileEntry = function() { | 71 fileSystem.getWritableFileEntry = function() { |
72 console.log("chrome.fileSystem.getWritableFileEntry is deprecated"); | 72 console.log("chrome.fileSystem.getWritableFileEntry is deprecated"); |
73 console.log("Please use chrome.fileSystem.getWritableEntry instead"); | 73 console.log("Please use chrome.fileSystem.getWritableEntry instead"); |
74 fileSystem.getWritableEntry.apply(this, arguments); | 74 fileSystem.getWritableEntry.apply(this, arguments); |
75 }; | 75 }; |
76 | 76 |
77 fileSystem.isWritableFileEntry = function() { | 77 fileSystem.isWritableFileEntry = function() { |
78 console.log("chrome.fileSystem.isWritableFileEntry is deprecated"); | 78 console.log("chrome.fileSystem.isWritableFileEntry is deprecated"); |
79 console.log("Please use chrome.fileSystem.isWritableEntry instead"); | 79 console.log("Please use chrome.fileSystem.isWritableEntry instead"); |
80 fileSystem.isWritableEntry.apply(this, arguments); | 80 fileSystem.isWritableEntry.apply(this, arguments); |
81 }; | 81 }; |
82 | 82 |
83 fileSystem.chooseFile = function() { | 83 fileSystem.chooseFile = function() { |
84 console.log("chrome.fileSystem.chooseFile is deprecated"); | 84 console.log("chrome.fileSystem.chooseFile is deprecated"); |
85 console.log("Please use chrome.fileSystem.chooseEntry instead"); | 85 console.log("Please use chrome.fileSystem.chooseEntry instead"); |
86 fileSystem.chooseEntry.apply(this, arguments); | 86 fileSystem.chooseEntry.apply(this, arguments); |
87 }; | 87 }; |
88 }); | 88 }); |
89 | 89 |
90 exports.binding = binding.generate(); | 90 exports.binding = binding.generate(); |
OLD | NEW |