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

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

Issue 1914643003: [Extensions] Update last_error.js, send_request.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 binding for the fileSystem API.
6 6
7 var binding = require('binding').Binding.create('fileSystem'); 7 var binding = require('binding').Binding.create('fileSystem');
8 var sendRequest = require('sendRequest'); 8 var sendRequest = require('sendRequest');
9 9
10 var getFileBindingsForApi = 10 var getFileBindingsForApi =
(...skipping 24 matching lines...) Expand all
35 }); 35 });
36 36
37 apiFunctions.setHandleRequest('retainEntry', function(fileEntry) { 37 apiFunctions.setHandleRequest('retainEntry', function(fileEntry) {
38 var id = entryIdManager.getEntryId(fileEntry); 38 var id = entryIdManager.getEntryId(fileEntry);
39 if (!id) 39 if (!id)
40 return ''; 40 return '';
41 var fileSystemName = fileEntry.filesystem.name; 41 var fileSystemName = fileEntry.filesystem.name;
42 var relativePath = $String.slice(fileEntry.fullPath, 1); 42 var relativePath = $String.slice(fileEntry.fullPath, 1);
43 43
44 sendRequest.sendRequest(this.name, [id, fileSystemName, relativePath], 44 sendRequest.sendRequest(this.name, [id, fileSystemName, relativePath],
45 this.definition.parameters, {}); 45 this.definition.parameters);
46 return id; 46 return id;
47 }); 47 });
48 48
49 apiFunctions.setHandleRequest('isRestorable', 49 apiFunctions.setHandleRequest('isRestorable',
50 function(id, callback) { 50 function(id, callback) {
51 var savedEntry = entryIdManager.getEntryById(id); 51 var savedEntry = entryIdManager.getEntryById(id);
52 if (savedEntry) { 52 if (savedEntry) {
53 sendRequest.safeCallbackApply( 53 sendRequest.safeCallbackApply(
54 'fileSystem.isRestorable', 54 'fileSystem.isRestorable',
55 {}, 55 {},
56 callback, 56 callback,
57 [true]); 57 [true]);
58 } else { 58 } else {
59 sendRequest.sendRequest( 59 sendRequest.sendRequest(
60 this.name, [id, callback], this.definition.parameters, {}); 60 this.name, [id, callback], this.definition.parameters);
61 } 61 }
62 }); 62 });
63 63
64 apiFunctions.setUpdateArgumentsPostValidate('restoreEntry', 64 apiFunctions.setUpdateArgumentsPostValidate('restoreEntry',
65 function(id, callback) { 65 function(id, callback) {
66 var savedEntry = entryIdManager.getEntryById(id); 66 var savedEntry = entryIdManager.getEntryById(id);
67 if (savedEntry) { 67 if (savedEntry) {
68 // We already have a file entry for this id so pass it to the callback and 68 // We already have a file entry for this id so pass it to the callback and
69 // send a request to the browser to move it to the back of the LRU. 69 // send a request to the browser to move it to the back of the LRU.
70 sendRequest.safeCallbackApply( 70 sendRequest.safeCallbackApply(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 fileSystem.chooseFile = function() { 110 fileSystem.chooseFile = function() {
111 console.log("chrome.fileSystem.chooseFile is deprecated"); 111 console.log("chrome.fileSystem.chooseFile is deprecated");
112 console.log("Please use chrome.fileSystem.chooseEntry instead"); 112 console.log("Please use chrome.fileSystem.chooseEntry instead");
113 $Function.apply(fileSystem.chooseEntry, this, arguments); 113 $Function.apply(fileSystem.chooseEntry, this, arguments);
114 }; 114 };
115 }); 115 });
116 116
117 exports.$set('bindFileEntryCallback', bindFileEntryCallback); 117 exports.$set('bindFileEntryCallback', bindFileEntryCallback);
118 exports.$set('binding', binding.generate()); 118 exports.$set('binding', binding.generate());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698