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

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

Issue 1151763007: Add the boilerplate for actions to File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 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
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 fileSystemProviderInternal = 8 var fileSystemProviderInternal =
9 require('binding').Binding.create('fileSystemProviderInternal').generate(); 9 require('binding').Binding.create('fileSystemProviderInternal').generate();
10 var eventBindings = require('event_bindings'); 10 var eventBindings = require('event_bindings');
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 var onErrorCallback = function(error) { 138 var onErrorCallback = function(error) {
139 fileSystemProviderInternal.operationRequestedError( 139 fileSystemProviderInternal.operationRequestedError(
140 options.fileSystemId, options.requestId, error, 140 options.fileSystemId, options.requestId, error,
141 Date.now() - executionStart); 141 Date.now() - executionStart);
142 } 142 }
143 143
144 dispatch([options, onSuccessCallback, onErrorCallback]); 144 dispatch([options, onSuccessCallback, onErrorCallback]);
145 }); 145 });
146 146
147 eventBindings.registerArgumentMassager( 147 eventBindings.registerArgumentMassager(
148 'fileSystemProvider.onGetActionsRequested',
149 function(args, dispatch) {
150 var executionStart = Date.now();
151 var options = args[0];
152 var onSuccessCallback = function(actions) {
153 fileSystemProviderInternal.getActionsRequestedSuccess(
154 options.fileSystemId,
155 options.requestId,
156 actions,
157 Date.now() - executionStart);
158 };
159
160 var onErrorCallback = function(error) {
161 fileSystemProviderInternal.operationRequestedError(
162 options.fileSystemId, options.requestId, error,
163 Date.now() - executionStart);
164 }
165
166 dispatch([options, onSuccessCallback, onErrorCallback]);
167 });
168
169 eventBindings.registerArgumentMassager(
148 'fileSystemProvider.onReadDirectoryRequested', 170 'fileSystemProvider.onReadDirectoryRequested',
149 function(args, dispatch) { 171 function(args, dispatch) {
150 var executionStart = Date.now(); 172 var executionStart = Date.now();
151 var options = args[0]; 173 var options = args[0];
152 var onSuccessCallback = function(entries, hasNext) { 174 var onSuccessCallback = function(entries, hasNext) {
153 var annotatedEntries = entries.map(annotateMetadata); 175 var annotatedEntries = entries.map(annotateMetadata);
154 // It is invalid to return a thumbnail when it's not requested. 176 // It is invalid to return a thumbnail when it's not requested.
155 var error; 177 var error;
156 annotatedEntries.forEach(function(metadata) { 178 annotatedEntries.forEach(function(metadata) {
157 if (metadata.thumbnail) { 179 if (metadata.thumbnail) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 var onSuccessCallback = function() { 288 var onSuccessCallback = function() {
267 // TODO(mtomasz): To be implemented. 289 // TODO(mtomasz): To be implemented.
268 }; 290 };
269 var onErrorCallback = function(error) { 291 var onErrorCallback = function(error) {
270 // TODO(mtomasz): To be implemented. 292 // TODO(mtomasz): To be implemented.
271 } 293 }
272 dispatch([onSuccessCallback, onErrorCallback]); 294 dispatch([onSuccessCallback, onErrorCallback]);
273 }); 295 });
274 296
275 exports.binding = binding.generate(); 297 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698