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

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

Issue 16439016: extfs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Custom bindings for the downloads API.
6
7 var binding = require('binding').Binding.create('extfs');
8 var eventBindings = require('event_bindings');
9
10 eventBindings.registerArgumentMassager(
11 'extfs.onEntryRequested',
12 function (args, dispatch) {
13 var requestId = args[0];
14 var path = args[1];
15 var callback = function(errorCode, entry) {
16 console.log('@@@@ calling returnEntry');
17 chrome.extfs.returnEntry(requestId, errorCode, entry);
18 };
19 console.log('@@@@ calling the original listener');
20 dispatch([path, callback]);
21 });
22
23 eventBindings.registerArgumentMassager(
24 'extfs.onDirectoryEntriesRequested',
25 function (args, dispatch) {
26 var requestId = args[0];
27 var path = args[1];
28 var callback = function(errorCode, entries) {
29 console.log('@@@@ calling returnEntries');
30 chrome.extfs.returnEntries(requestId, errorCode, entries);
31 };
32 console.log('@@@@ calling the original listener');
33 dispatch([path, callback]);
34 });
35
36 eventBindings.registerArgumentMassager(
37 'extfs.onSnapshotRequested',
38 function (args, dispatch) {
39 var requestId = args[0];
40 var path = args[1];
41 var callback = function(errorCode, blob) {
42 console.log('@@@@ calling returnSnapshot');
43 console.log('@@@@ blob: ' + blob);
44 console.log('@@@@ requestId: ' + requestId);
45 chrome.extfs.returnSnapshot(requestId, errorCode, blob);
46 };
47 console.log('@@@@ calling the original listener');
48 dispatch([path, callback]);
49 });
50
51 binding.registerCustomHook(function(bindingsAPI) {
52 var apiFunctions = bindingsAPI.apiFunctions;
53 apiFunctions.setUpdateArgumentsPostValidate(
54 "returnSnapshot", function(requestId, errorCode, blob) {
55 console.log('@@@@ intercepting returnSnapshot');
56 // The blob URL will be revoked in the browser.
57 var blobURL = window.URL.createObjectURL(blob);
58 console.log('@@@@ blobURL: ' + blobURL);
59 console.log('@@@@ requestId: ' + requestId);
60 return [requestId, errorCode, blobURL];
61 });
62 });
63
64 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/dispatcher.cc ('k') | chrome/renderer/resources/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698