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

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

Issue 55903005: File system provider. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « chrome/common/extensions/api/file_system_provider.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 fileSystemProvider API. 5 // Custom binding for the fileSystemProvider API.
6 6
7 var binding = require('binding').Binding.create('fileSystemProvider'); 7 var binding = require('binding').Binding.create('fileSystemProvider');
8 var fileSystemProviderNatives = requireNative('file_system_provider'); 8 var fileSystemProviderNatives = requireNative('file_system_provider');
9 var GetDOMError = fileSystemProviderNatives.GetDOMError; 9 var GetDOMError = fileSystemProviderNatives.GetDOMError;
10 10
11 binding.registerCustomHook(function(bindingsAPI) { 11 binding.registerCustomHook(function(bindingsAPI) {
12 var apiFunctions = bindingsAPI.apiFunctions; 12 var apiFunctions = bindingsAPI.apiFunctions;
13 13
14 apiFunctions.setUpdateArgumentsPostValidate('mount', function() {
15 // Hold onto the error callback or something.
16 });
17
14 apiFunctions.setCustomCallback( 18 apiFunctions.setCustomCallback(
15 'mount', 19 'mount',
16 function(name, request, response) { 20 function(name, request, response) {
17 var domError = null; 21 var domError = null;
18 var fileSystemId = null; 22 var fileSystemId = null;
19 if (response) { 23 if (response) {
20 // Convert a Dictionary to a DomError. 24 fileSystemId = response[0]
21 domError = GetDOMError(response[0].name, response[0].message); 25 if (reponse[1]) {
22 fileSystemId = response[1] 26 domError = GetDOMError(response[1].name, response[1].message);
27 response.length = 1;
28 }
23 } 29 }
24 30
25 if (request.callback) { 31 var successCallback = request.callback;
26 request.callback(domError, fileSystemId); 32 delete request.callback;
27 request.callback = null; 33 if (domError && request.failureCallback)
28 } 34 request.failureCallback(domError);
35 if (!domError && successCallback)
36 successCallback(fileSystemId)
29 }); 37 });
30 }); 38 });
31 39
32 exports.binding = binding.generate(); 40 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/file_system_provider.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698