Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: chrome/renderer/resources/extensions/file_system_custom_bindings.js

Issue 12313142: Revert 184837 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 bindings for the fileSystem API.
6 6
7 var binding = require('binding').Binding.create('fileSystem'); 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
8
9 var fileSystemNatives = requireNative('file_system_natives'); 8 var fileSystemNatives = requireNative('file_system_natives');
10 var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem; 9 var GetIsolatedFileSystem = fileSystemNatives.GetIsolatedFileSystem;
11 var lastError = require('lastError'); 10 var lastError = require('lastError');
12 var entryIdManager = require('entryIdManager'); 11 var entryIdManager = require('entryIdManager');
13 12
14 binding.registerCustomHook(function(bindingsAPI) { 13 chromeHidden.registerCustomHook('fileSystem', function(bindingsAPI) {
15 var apiFunctions = bindingsAPI.apiFunctions; 14 var apiFunctions = bindingsAPI.apiFunctions;
16 var fileSystem = bindingsAPI.compiledApi;
17
18 function bindFileEntryFunction(functionName) { 15 function bindFileEntryFunction(functionName) {
19 apiFunctions.setUpdateArgumentsPostValidate( 16 apiFunctions.setUpdateArgumentsPostValidate(
20 functionName, function(fileEntry, callback) { 17 functionName, function(fileEntry, callback) {
21 var fileSystemName = fileEntry.filesystem.name; 18 var fileSystemName = fileEntry.filesystem.name;
22 var relativePath = fileEntry.fullPath.slice(1); 19 var relativePath = fileEntry.fullPath.slice(1);
23 return [fileSystemName, relativePath, callback]; 20 return [fileSystemName, relativePath, callback];
24 }); 21 });
25 } 22 }
26 ['getDisplayPath', 'getWritableEntry', 'isWritableEntry'] 23 ['getDisplayPath', 'getWritableEntry', 'isWritableEntry']
27 .forEach(bindFileEntryFunction); 24 .forEach(bindFileEntryFunction);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 58
62 apiFunctions.setHandleRequest('getEntryId', function(fileEntry) { 59 apiFunctions.setHandleRequest('getEntryId', function(fileEntry) {
63 return entryIdManager.getEntryId(fileEntry); 60 return entryIdManager.getEntryId(fileEntry);
64 }); 61 });
65 62
66 apiFunctions.setHandleRequest('getEntryById', function(id) { 63 apiFunctions.setHandleRequest('getEntryById', function(id) {
67 return entryIdManager.getEntryById(id); 64 return entryIdManager.getEntryById(id);
68 }); 65 });
69 66
70 // TODO(benwells): Remove these deprecated versions of the functions. 67 // TODO(benwells): Remove these deprecated versions of the functions.
71 fileSystem.getWritableFileEntry = function() { 68 chrome.fileSystem.getWritableFileEntry = function() {
72 console.log("chrome.fileSystem.getWritableFileEntry is deprecated"); 69 console.log("chrome.fileSystem.getWritableFileEntry is deprecated");
73 console.log("Please use chrome.fileSystem.getWritableEntry instead"); 70 console.log("Please use chrome.fileSystem.getWritableEntry instead");
74 fileSystem.getWritableEntry.apply(this, arguments); 71 chrome.fileSystem.getWritableEntry.apply(this, arguments);
75 }; 72 };
76 73
77 fileSystem.isWritableFileEntry = function() { 74 chrome.fileSystem.isWritableFileEntry = function() {
78 console.log("chrome.fileSystem.isWritableFileEntry is deprecated"); 75 console.log("chrome.fileSystem.isWritableFileEntry is deprecated");
79 console.log("Please use chrome.fileSystem.isWritableEntry instead"); 76 console.log("Please use chrome.fileSystem.isWritableEntry instead");
80 fileSystem.isWritableEntry.apply(this, arguments); 77 chrome.fileSystem.isWritableEntry.apply(this, arguments);
81 }; 78 };
82 79
83 fileSystem.chooseFile = function() { 80 chrome.fileSystem.chooseFile = function() {
84 console.log("chrome.fileSystem.chooseFile is deprecated"); 81 console.log("chrome.fileSystem.chooseFile is deprecated");
85 console.log("Please use chrome.fileSystem.chooseEntry instead"); 82 console.log("Please use chrome.fileSystem.chooseEntry instead");
86 fileSystem.chooseEntry.apply(this, arguments); 83 chrome.fileSystem.chooseEntry.apply(this, arguments);
87 }; 84 };
88 }); 85 });
89
90 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698