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

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

Issue 12391006: Give an app the file entries it had back on restart. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile (chromium style) Created 7 years, 9 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 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 18 matching lines...) Expand all
29 29
30 function bindFileEntryCallback(i, functionName) { 30 function bindFileEntryCallback(i, functionName) {
31 apiFunctions.setCustomCallback(functionName, 31 apiFunctions.setCustomCallback(functionName,
32 function(name, request, response) { 32 function(name, request, response) {
33 if (request.callback && response) { 33 if (request.callback && response) {
34 var callback = request.callback; 34 var callback = request.callback;
35 request.callback = null; 35 request.callback = null;
36 36
37 var fileSystemId = response.fileSystemId; 37 var fileSystemId = response.fileSystemId;
38 var baseName = response.baseName; 38 var baseName = response.baseName;
39 // TODO(koz): Generate a persistent id in the browser and use it here. 39 var id = response.id;
40 var id = fileSystemId + ":" + baseName;
41 var fs = GetIsolatedFileSystem(fileSystemId); 40 var fs = GetIsolatedFileSystem(fileSystemId);
42 41
43 try { 42 try {
44 // TODO(koz): fs.root.getFile() makes a trip to the browser process, 43 // TODO(koz): fs.root.getFile() makes a trip to the browser process,
45 // but it might be possible avoid that by calling 44 // but it might be possible avoid that by calling
46 // WebFrame::createFileEntry(). 45 // WebFrame::createFileEntry().
47 fs.root.getFile(baseName, {}, function(fileEntry) { 46 fs.root.getFile(baseName, {}, function(fileEntry) {
48 entryIdManager.registerEntry(id, fileEntry); 47 entryIdManager.registerEntry(id, fileEntry);
49 callback(fileEntry); 48 callback(fileEntry);
50 }, function(fileError) { 49 }, function(fileError) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 }; 81 };
83 82
84 fileSystem.chooseFile = function() { 83 fileSystem.chooseFile = function() {
85 console.log("chrome.fileSystem.chooseFile is deprecated"); 84 console.log("chrome.fileSystem.chooseFile is deprecated");
86 console.log("Please use chrome.fileSystem.chooseEntry instead"); 85 console.log("Please use chrome.fileSystem.chooseEntry instead");
87 fileSystem.chooseEntry.apply(this, arguments); 86 fileSystem.chooseEntry.apply(this, arguments);
88 }; 87 };
89 }); 88 });
90 89
91 exports.binding = binding.generate(); 90 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698