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

Unified Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 6749021: Added new fileBrowserPrivate and fileHandler extension APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extension_process_bindings.js
===================================================================
--- chrome/renderer/resources/extension_process_bindings.js (revision 81212)
+++ chrome/renderer/resources/extension_process_bindings.js (working copy)
@@ -97,7 +97,6 @@
"message": error
};
}
-
Aaron Boodman 2011/04/12 22:47:21 Unnecessary change.
if (request.customCallback) {
request.customCallback(name, request, response);
}
@@ -660,6 +659,44 @@
});
};
+ apiFunctions["fileSystem.resolveLocalFileSystemURL"].customCallback =
Aaron Boodman 2011/04/12 22:47:21 I think you are planning to remove this soon?
zel 2011/04/13 17:49:55 It's gone now.
+ function(name, request, response) {
+ var method_callback = request.callback;
+ var successCallback = function(entry) {
+ method_callback(entry);
+ };
+ var errorCallback = function(err) {
+ chrome.extension.lastError = {
+ "message": "File error " + err.code
+ };
+ method_callback(null);
+ };
+ var fs = null;
+ var resp = response ? [chromeHidden.JSON.parse(response)] : null;
+ if (!resp || !resp.length || !resp[0]) {
+ errorCallback({"code": -255});
+ return;
+ } else if (resp[0].error) {
+ errorCallback({"code": resp[0].error});
+ return;
+ }
+ // Get local file system instance.
+ fs = GetLocalFileSystem(resp[0].name, resp[0].path);
+ if (resp[0].fileUrl.substr(0, resp[0].path.length) != resp[0].path) {
+ errorCallback({"code": FileError.NOT_FOUND_ERR});
+ return;
+ }
+ var file_path = resp[0].fileUrl.substr(resp[0].path.length);
+ // Try to get directory.
+ fs.root.getDirectory(file_path, {create: false},
+ successCallback, function(err) {
+ // Not a directory? Maybe it's a file then.
+ fs.root.getFile(file_path, {create: false}, successCallback,
+ errorCallback);
+ });
+ request.callback = null;
+ };
+
apiFunctions["fileBrowserPrivate.requestLocalFileSystem"].customCallback =
function(name, request, response) {
var resp = response ? [chromeHidden.JSON.parse(response)] : [];

Powered by Google App Engine
This is Rietveld 408576698