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

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

Issue 15841013: Make miscellaneous_bindings and event_bindings Required as needed. Previously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); 9 var eventBindings = require('event_bindings');
10 var fileSystemNatives = requireNative('file_system_natives'); 10 var fileSystemNatives = requireNative('file_system_natives');
11 var forEach = require('utils').forEach; 11 var forEach = require('utils').forEach;
12 var syncFileSystemNatives = requireNative('sync_file_system'); 12 var syncFileSystemNatives = requireNative('sync_file_system');
13 13
14 binding.registerCustomHook(function(bindingsAPI) { 14 binding.registerCustomHook(function(bindingsAPI) {
15 var apiFunctions = bindingsAPI.apiFunctions; 15 var apiFunctions = bindingsAPI.apiFunctions;
16 16
17 // Functions which take in an [instanceOf=FileEntry]. 17 // Functions which take in an [instanceOf=FileEntry].
18 function bindFileEntryFunction(i, functionName) { 18 function bindFileEntryFunction(i, functionName) {
19 apiFunctions.setUpdateArgumentsPostValidate( 19 apiFunctions.setUpdateArgumentsPostValidate(
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 result.error = response[i].error; 79 result.error = response[i].error;
80 results.push(result); 80 results.push(result);
81 } 81 }
82 } 82 }
83 if (request.callback) 83 if (request.callback)
84 request.callback(results); 84 request.callback(results);
85 request.callback = null; 85 request.callback = null;
86 }); 86 });
87 }); 87 });
88 88
89 chromeHidden.Event.registerArgumentMassager( 89 eventBindings.registerArgumentMassager(
90 'syncFileSystem.onFileStatusChanged', function(args, dispatch) { 90 'syncFileSystem.onFileStatusChanged', function(args, dispatch) {
91 // Make FileEntry object using all the base string fields. 91 // Make FileEntry object using all the base string fields.
92 var fileEntry = fileSystemNatives.GetFileEntry( 92 var fileEntry = fileSystemNatives.GetFileEntry(
93 args[0].fileSystemType, 93 args[0].fileSystemType,
94 args[0].fileSystemName, 94 args[0].fileSystemName,
95 args[0].rootUrl, 95 args[0].rootUrl,
96 args[0].filePath, 96 args[0].filePath,
97 args[0].isDirectory); 97 args[0].isDirectory);
98 98
99 // Combine into a single dictionary. 99 // Combine into a single dictionary.
100 var fileInfo = new Object(); 100 var fileInfo = new Object();
101 fileInfo.fileEntry = fileEntry; 101 fileInfo.fileEntry = fileEntry;
102 fileInfo.status = args[1]; 102 fileInfo.status = args[1];
103 if (fileInfo.status == "synced") { 103 if (fileInfo.status == "synced") {
104 fileInfo.action = args[2]; 104 fileInfo.action = args[2];
105 fileInfo.direction = args[3]; 105 fileInfo.direction = args[3];
106 } 106 }
107 dispatch([fileInfo]); 107 dispatch([fileInfo]);
108 }); 108 });
109 109
110 exports.binding = binding.generate(); 110 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698