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

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

Issue 17451011: Make the externally connectable browser test clobber all of the builtins, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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 syncFileSystem API. 5 // Custom binding for the syncFileSystem API.
6 6
7 var binding = require('binding').Binding.create('syncFileSystem'); 7 var binding = require('binding').Binding.create('syncFileSystem');
8 8
9 var eventBindings = require('event_bindings'); 9 var eventBindings = require('event_bindings');
10 var fileSystemNatives = requireNative('file_system_natives'); 10 var fileSystemNatives = requireNative('file_system_natives');
(...skipping 11 matching lines...) Expand all
22 }); 22 });
23 } 23 }
24 $Array.forEach(['getFileStatus'], bindFileEntryFunction); 24 $Array.forEach(['getFileStatus'], bindFileEntryFunction);
25 25
26 // Functions which take in an [instanceOf=EntryArray]. 26 // Functions which take in an [instanceOf=EntryArray].
27 function bindFileEntryArrayFunction(functionName) { 27 function bindFileEntryArrayFunction(functionName) {
28 apiFunctions.setUpdateArgumentsPostValidate( 28 apiFunctions.setUpdateArgumentsPostValidate(
29 functionName, function(entries, callback) { 29 functionName, function(entries, callback) {
30 var fileSystemUrlArray = []; 30 var fileSystemUrlArray = [];
31 for (var i=0; i < entries.length; i++) { 31 for (var i=0; i < entries.length; i++) {
32 fileSystemUrlArray.push(entries[i].toURL()); 32 $Array.push(fileSystemUrlArray, entries[i].toURL());
33 } 33 }
34 return [fileSystemUrlArray, callback]; 34 return [fileSystemUrlArray, callback];
35 }); 35 });
36 } 36 }
37 $Array.forEach(['getFileStatuses'], bindFileEntryArrayFunction); 37 $Array.forEach(['getFileStatuses'], bindFileEntryArrayFunction);
38 38
39 // Functions which take in an [instanceOf=DOMFileSystem]. 39 // Functions which take in an [instanceOf=DOMFileSystem].
40 function bindFileSystemFunction(functionName) { 40 function bindFileSystemFunction(functionName) {
41 apiFunctions.setUpdateArgumentsPostValidate( 41 apiFunctions.setUpdateArgumentsPostValidate(
42 functionName, function(filesystem, callback) { 42 functionName, function(filesystem, callback) {
(...skipping 26 matching lines...) Expand all
69 var result = {}; 69 var result = {};
70 var entry = response[i].entry; 70 var entry = response[i].entry;
71 result.fileEntry = fileSystemNatives.GetFileEntry( 71 result.fileEntry = fileSystemNatives.GetFileEntry(
72 entry.fileSystemType, 72 entry.fileSystemType,
73 entry.fileSystemName, 73 entry.fileSystemName,
74 entry.rootUrl, 74 entry.rootUrl,
75 entry.filePath, 75 entry.filePath,
76 entry.isDirectory); 76 entry.isDirectory);
77 result.status = response[i].status; 77 result.status = response[i].status;
78 result.error = response[i].error; 78 result.error = response[i].error;
79 results.push(result); 79 $Array.push(results, result);
80 } 80 }
81 } 81 }
82 if (request.callback) 82 if (request.callback)
83 request.callback(results); 83 request.callback(results);
84 request.callback = null; 84 request.callback = null;
85 }); 85 });
86 }); 86 });
87 87
88 eventBindings.registerArgumentMassager( 88 eventBindings.registerArgumentMassager(
89 'syncFileSystem.onFileStatusChanged', function(args, dispatch) { 89 'syncFileSystem.onFileStatusChanged', function(args, dispatch) {
(...skipping 10 matching lines...) Expand all
100 fileInfo.fileEntry = fileEntry; 100 fileInfo.fileEntry = fileEntry;
101 fileInfo.status = args[1]; 101 fileInfo.status = args[1];
102 if (fileInfo.status == "synced") { 102 if (fileInfo.status == "synced") {
103 fileInfo.action = args[2]; 103 fileInfo.action = args[2];
104 fileInfo.direction = args[3]; 104 fileInfo.direction = args[3];
105 } 105 }
106 dispatch([fileInfo]); 106 dispatch([fileInfo]);
107 }); 107 });
108 108
109 exports.binding = binding.generate(); 109 exports.binding = binding.generate();
OLDNEW
« no previous file with comments | « chrome/renderer/resources/extensions/storage_area.js ('k') | chrome/renderer/resources/extensions/test_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698