OLD | NEW |
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 fileManagerPrivate API. | 5 // Custom binding for the fileManagerPrivate API. |
6 | 6 |
7 // Bindings | 7 // Bindings |
8 var binding = require('binding').Binding.create('fileManagerPrivate'); | 8 var binding = require('binding').Binding.create('fileManagerPrivate'); |
9 var eventBindings = require('event_bindings'); | 9 var eventBindings = require('event_bindings'); |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 apiFunctions.setHandleRequest('addFileWatch', function(entry, callback) { | 80 apiFunctions.setHandleRequest('addFileWatch', function(entry, callback) { |
81 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 81 var url = fileBrowserHandlerNatives.GetEntryURL(entry); |
82 fileManagerPrivateInternal.addFileWatch(url, callback); | 82 fileManagerPrivateInternal.addFileWatch(url, callback); |
83 }); | 83 }); |
84 | 84 |
85 apiFunctions.setHandleRequest('removeFileWatch', function(entry, callback) { | 85 apiFunctions.setHandleRequest('removeFileWatch', function(entry, callback) { |
86 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 86 var url = fileBrowserHandlerNatives.GetEntryURL(entry); |
87 fileManagerPrivateInternal.removeFileWatch(url, callback); | 87 fileManagerPrivateInternal.removeFileWatch(url, callback); |
88 }); | 88 }); |
89 | 89 |
90 apiFunctions.setHandleRequest('getEntryActions', function(entry, callback) { | 90 apiFunctions.setHandleRequest('getCustomActions', function( |
91 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 91 entries, callback) { |
92 fileManagerPrivateInternal.getEntryActions(url, callback); | 92 var urls = entries.map(function(entry) { |
| 93 return fileBrowserHandlerNatives.GetEntryURL(entry); |
| 94 }); |
| 95 fileManagerPrivateInternal.getCustomActions(urls, callback); |
93 }); | 96 }); |
94 | 97 |
95 apiFunctions.setHandleRequest('executeEntryAction', function( | 98 apiFunctions.setHandleRequest('executeCustomAction', function( |
96 entry, actionId, callback) { | 99 entries, actionId, callback) { |
97 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 100 var urls = entries.map(function(entry) { |
98 fileManagerPrivateInternal.executeEntryAction(url, actionId, callback); | 101 return fileBrowserHandlerNatives.GetEntryURL(entry); |
| 102 }); |
| 103 fileManagerPrivateInternal.executeCustomAction(urls, actionId, callback); |
99 }); | 104 }); |
100 | 105 |
101 apiFunctions.setHandleRequest('computeChecksum', function(entry, callback) { | 106 apiFunctions.setHandleRequest('computeChecksum', function(entry, callback) { |
102 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 107 var url = fileBrowserHandlerNatives.GetEntryURL(entry); |
103 fileManagerPrivateInternal.computeChecksum(url, callback); | 108 fileManagerPrivateInternal.computeChecksum(url, callback); |
104 }); | 109 }); |
105 | 110 |
106 apiFunctions.setHandleRequest('getMimeType', function(entry, callback) { | 111 apiFunctions.setHandleRequest('getMimeType', function(entry, callback) { |
107 var url = fileBrowserHandlerNatives.GetEntryURL(entry); | 112 var url = fileBrowserHandlerNatives.GetEntryURL(entry); |
108 fileManagerPrivateInternal.getMimeType(url, callback); | 113 fileManagerPrivateInternal.getMimeType(url, callback); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 }); | 199 }); |
195 | 200 |
196 eventBindings.registerArgumentMassager( | 201 eventBindings.registerArgumentMassager( |
197 'fileManagerPrivate.onDirectoryChanged', function(args, dispatch) { | 202 'fileManagerPrivate.onDirectoryChanged', function(args, dispatch) { |
198 // Convert the entry arguments into a real Entry object. | 203 // Convert the entry arguments into a real Entry object. |
199 args[0].entry = GetExternalFileEntry(args[0].entry); | 204 args[0].entry = GetExternalFileEntry(args[0].entry); |
200 dispatch(args); | 205 dispatch(args); |
201 }); | 206 }); |
202 | 207 |
203 exports.binding = binding.generate(); | 208 exports.binding = binding.generate(); |
OLD | NEW |