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

Side by Side Diff: chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc

Issue 2408483002: [Extensions] Convert some ChromeSyncExtensionFunctions (Closed)
Patch Set: lazyboy's Created 4 years, 2 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 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr ovider_api.h" 5 #include "chrome/browser/chromeos/extensions/file_system_provider/file_system_pr ovider_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 base::File::Error result) { 266 base::File::Error result) {
267 if (result != base::File::FILE_OK) { 267 if (result != base::File::FILE_OK) {
268 SetError(FileErrorToString(result)); 268 SetError(FileErrorToString(result));
269 SendResponse(false); 269 SendResponse(false);
270 return; 270 return;
271 } 271 }
272 272
273 SendResponse(true); 273 SendResponse(true);
274 } 274 }
275 275
276 bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { 276 ExtensionFunction::ResponseAction
277 FileSystemProviderInternalUnmountRequestedSuccessFunction::Run() {
277 using api::file_system_provider_internal::UnmountRequestedSuccess::Params; 278 using api::file_system_provider_internal::UnmountRequestedSuccess::Params;
278 std::unique_ptr<Params> params(Params::Create(*args_)); 279 std::unique_ptr<Params> params(Params::Create(*args_));
279 EXTENSION_FUNCTION_VALIDATE(params); 280 EXTENSION_FUNCTION_VALIDATE(params);
280 281
281 return FulfillRequest( 282 return FulfillRequest(
282 RequestValue::CreateForUnmountSuccess(std::move(params)), 283 RequestValue::CreateForUnmountSuccess(std::move(params)),
283 false /* has_more */); 284 false /* has_more */);
284 } 285 }
285 286
286 bool 287 ExtensionFunction::ResponseAction
287 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { 288 FileSystemProviderInternalGetMetadataRequestedSuccessFunction::Run() {
288 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params; 289 using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params;
289 std::unique_ptr<Params> params(Params::Create(*args_)); 290 std::unique_ptr<Params> params(Params::Create(*args_));
290 EXTENSION_FUNCTION_VALIDATE(params); 291 EXTENSION_FUNCTION_VALIDATE(params);
291 292
292 return FulfillRequest( 293 return FulfillRequest(
293 RequestValue::CreateForGetMetadataSuccess(std::move(params)), 294 RequestValue::CreateForGetMetadataSuccess(std::move(params)),
294 false /* has_more */); 295 false /* has_more */);
295 } 296 }
296 297
297 bool FileSystemProviderInternalGetActionsRequestedSuccessFunction:: 298 ExtensionFunction::ResponseAction
298 RunWhenValid() { 299 FileSystemProviderInternalGetActionsRequestedSuccessFunction::Run() {
299 using api::file_system_provider_internal::GetActionsRequestedSuccess::Params; 300 using api::file_system_provider_internal::GetActionsRequestedSuccess::Params;
300 std::unique_ptr<Params> params(Params::Create(*args_)); 301 std::unique_ptr<Params> params(Params::Create(*args_));
301 EXTENSION_FUNCTION_VALIDATE(params); 302 EXTENSION_FUNCTION_VALIDATE(params);
302 303
303 return FulfillRequest( 304 return FulfillRequest(
304 RequestValue::CreateForGetActionsSuccess(std::move(params)), 305 RequestValue::CreateForGetActionsSuccess(std::move(params)),
305 false /* has_more */); 306 false /* has_more */);
306 } 307 }
307 308
308 bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: 309 ExtensionFunction::ResponseAction
309 RunWhenValid() { 310 FileSystemProviderInternalReadDirectoryRequestedSuccessFunction::Run() {
310 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess:: 311 using api::file_system_provider_internal::ReadDirectoryRequestedSuccess::
311 Params; 312 Params;
312 std::unique_ptr<Params> params(Params::Create(*args_)); 313 std::unique_ptr<Params> params(Params::Create(*args_));
313 EXTENSION_FUNCTION_VALIDATE(params); 314 EXTENSION_FUNCTION_VALIDATE(params);
314 315
315 const bool has_more = params->has_more; 316 const bool has_more = params->has_more;
316 return FulfillRequest( 317 return FulfillRequest(
317 RequestValue::CreateForReadDirectorySuccess(std::move(params)), has_more); 318 RequestValue::CreateForReadDirectorySuccess(std::move(params)), has_more);
318 } 319 }
319 320
320 bool 321 ExtensionFunction::ResponseAction
321 FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { 322 FileSystemProviderInternalReadFileRequestedSuccessFunction::Run() {
322 TRACE_EVENT0("file_system_provider", "ReadFileRequestedSuccess"); 323 TRACE_EVENT0("file_system_provider", "ReadFileRequestedSuccess");
323 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; 324 using api::file_system_provider_internal::ReadFileRequestedSuccess::Params;
324 325
325 std::unique_ptr<Params> params(Params::Create(*args_)); 326 std::unique_ptr<Params> params(Params::Create(*args_));
326 EXTENSION_FUNCTION_VALIDATE(params); 327 EXTENSION_FUNCTION_VALIDATE(params);
327 328
328 const bool has_more = params->has_more; 329 const bool has_more = params->has_more;
329 return FulfillRequest( 330 return FulfillRequest(
330 RequestValue::CreateForReadFileSuccess(std::move(params)), has_more); 331 RequestValue::CreateForReadFileSuccess(std::move(params)), has_more);
331 } 332 }
332 333
333 bool 334 ExtensionFunction::ResponseAction
334 FileSystemProviderInternalOperationRequestedSuccessFunction::RunWhenValid() { 335 FileSystemProviderInternalOperationRequestedSuccessFunction::Run() {
335 using api::file_system_provider_internal::OperationRequestedSuccess::Params; 336 using api::file_system_provider_internal::OperationRequestedSuccess::Params;
336 std::unique_ptr<Params> params(Params::Create(*args_)); 337 std::unique_ptr<Params> params(Params::Create(*args_));
337 EXTENSION_FUNCTION_VALIDATE(params); 338 EXTENSION_FUNCTION_VALIDATE(params);
338 339
339 return FulfillRequest( 340 return FulfillRequest(
340 std::unique_ptr<RequestValue>( 341 std::unique_ptr<RequestValue>(
341 RequestValue::CreateForOperationSuccess(std::move(params))), 342 RequestValue::CreateForOperationSuccess(std::move(params))),
342 false /* has_more */); 343 false /* has_more */);
343 } 344 }
344 345
345 bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() { 346 ExtensionFunction::ResponseAction
347 FileSystemProviderInternalOperationRequestedErrorFunction::Run() {
346 using api::file_system_provider_internal::OperationRequestedError::Params; 348 using api::file_system_provider_internal::OperationRequestedError::Params;
347 std::unique_ptr<Params> params(Params::Create(*args_)); 349 std::unique_ptr<Params> params(Params::Create(*args_));
348 EXTENSION_FUNCTION_VALIDATE(params); 350 EXTENSION_FUNCTION_VALIDATE(params);
349 351
350 const base::File::Error error = ProviderErrorToFileError(params->error); 352 const base::File::Error error = ProviderErrorToFileError(params->error);
351 return RejectRequest(RequestValue::CreateForOperationError(std::move(params)), 353 return RejectRequest(RequestValue::CreateForOperationError(std::move(params)),
352 error); 354 error);
353 } 355 }
354 356
355 } // namespace extensions 357 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698