OLD | NEW |
---|---|
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_manager/private_api_file_syste m.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste m.h" |
6 | 6 |
7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
8 #include <sys/statvfs.h> | 8 #include <sys/statvfs.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <utime.h> | 10 #include <utime.h> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 249 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
250 fileapi::FileSystemOperationRunner::OperationID operation_id) { | 250 fileapi::FileSystemOperationRunner::OperationID operation_id) { |
251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
252 | 252 |
253 file_system_context->operation_runner()->Cancel( | 253 file_system_context->operation_runner()->Cancel( |
254 operation_id, base::Bind(&OnCopyCancelled)); | 254 operation_id, base::Bind(&OnCopyCancelled)); |
255 } | 255 } |
256 | 256 |
257 } // namespace | 257 } // namespace |
258 | 258 |
259 FileBrowserPrivateRequestFileSystemFunction:: | |
260 FileBrowserPrivateRequestFileSystemFunction() { | |
261 } | |
262 | |
263 FileBrowserPrivateRequestFileSystemFunction:: | |
264 ~FileBrowserPrivateRequestFileSystemFunction() { | |
265 } | |
266 | |
267 void FileBrowserPrivateRequestFileSystemFunction::DidOpenFileSystem( | 259 void FileBrowserPrivateRequestFileSystemFunction::DidOpenFileSystem( |
268 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 260 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
269 base::PlatformFileError result, | 261 base::PlatformFileError result, |
270 const std::string& name, | 262 const std::string& name, |
271 const GURL& root_url) { | 263 const GURL& root_url) { |
272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
273 | 265 |
274 if (result != base::PLATFORM_FILE_OK) { | 266 if (result != base::PLATFORM_FILE_OK) { |
275 DidFail(result); | 267 DidFail(result); |
276 return; | 268 return; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 origin_url, | 367 origin_url, |
376 fileapi::kFileSystemTypeExternal, | 368 fileapi::kFileSystemTypeExternal, |
377 fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, | 369 fileapi::OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, |
378 base::Bind(&FileBrowserPrivateRequestFileSystemFunction:: | 370 base::Bind(&FileBrowserPrivateRequestFileSystemFunction:: |
379 DidOpenFileSystem, | 371 DidOpenFileSystem, |
380 this, | 372 this, |
381 file_system_context)); | 373 file_system_context)); |
382 return true; | 374 return true; |
383 } | 375 } |
384 | 376 |
385 FileWatchFunctionBase::FileWatchFunctionBase() { | |
386 } | |
387 | |
388 FileWatchFunctionBase::~FileWatchFunctionBase() { | |
389 } | |
390 | |
391 void FileWatchFunctionBase::Respond(bool success) { | 377 void FileWatchFunctionBase::Respond(bool success) { |
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
393 | 379 |
394 SetResult(Value::CreateBooleanValue(success)); | 380 SetResult(Value::CreateBooleanValue(success)); |
395 SendResponse(success); | 381 SendResponse(success); |
396 } | 382 } |
397 | 383 |
398 bool FileWatchFunctionBase::RunImpl() { | 384 bool FileWatchFunctionBase::RunImpl() { |
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 385 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
400 | 386 |
(...skipping 14 matching lines...) Expand all Loading... | |
415 base::FilePath virtual_path = file_watch_url.virtual_path(); | 401 base::FilePath virtual_path = file_watch_url.virtual_path(); |
416 if (local_path.empty()) { | 402 if (local_path.empty()) { |
417 Respond(false); | 403 Respond(false); |
418 return true; | 404 return true; |
419 } | 405 } |
420 PerformFileWatchOperation(local_path, virtual_path, extension_id()); | 406 PerformFileWatchOperation(local_path, virtual_path, extension_id()); |
421 | 407 |
422 return true; | 408 return true; |
423 } | 409 } |
424 | 410 |
425 FileBrowserPrivateAddFileWatchFunction:: | |
426 FileBrowserPrivateAddFileWatchFunction() { | |
427 } | |
428 | |
429 FileBrowserPrivateAddFileWatchFunction:: | |
430 ~FileBrowserPrivateAddFileWatchFunction() { | |
431 } | |
432 | |
433 void FileBrowserPrivateAddFileWatchFunction::PerformFileWatchOperation( | 411 void FileBrowserPrivateAddFileWatchFunction::PerformFileWatchOperation( |
434 const base::FilePath& local_path, | 412 const base::FilePath& local_path, |
435 const base::FilePath& virtual_path, | 413 const base::FilePath& virtual_path, |
436 const std::string& extension_id) { | 414 const std::string& extension_id) { |
437 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 415 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
438 | 416 |
439 file_manager::EventRouter* event_router = | 417 file_manager::EventRouter* event_router = |
440 file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router(); | 418 file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router(); |
441 event_router->AddFileWatch( | 419 event_router->AddFileWatch( |
442 local_path, | 420 local_path, |
443 virtual_path, | 421 virtual_path, |
444 extension_id, | 422 extension_id, |
445 base::Bind(&FileBrowserPrivateAddFileWatchFunction::Respond, this)); | 423 base::Bind(&FileBrowserPrivateAddFileWatchFunction::Respond, this)); |
446 } | 424 } |
447 | 425 |
448 FileBrowserPrivateRemoveFileWatchFunction:: | |
449 FileBrowserPrivateRemoveFileWatchFunction() { | |
450 } | |
451 | |
452 FileBrowserPrivateRemoveFileWatchFunction:: | |
453 ~FileBrowserPrivateRemoveFileWatchFunction() { | |
454 } | |
455 | |
456 void FileBrowserPrivateRemoveFileWatchFunction::PerformFileWatchOperation( | 426 void FileBrowserPrivateRemoveFileWatchFunction::PerformFileWatchOperation( |
457 const base::FilePath& local_path, | 427 const base::FilePath& local_path, |
458 const base::FilePath& unused, | 428 const base::FilePath& unused, |
459 const std::string& extension_id) { | 429 const std::string& extension_id) { |
460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 430 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
461 | 431 |
462 file_manager::EventRouter* event_router = | 432 file_manager::EventRouter* event_router = |
463 file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router(); | 433 file_manager::FileBrowserPrivateAPI::Get(profile_)->event_router(); |
464 event_router->RemoveFileWatch(local_path, extension_id); | 434 event_router->RemoveFileWatch(local_path, extension_id); |
465 Respond(true); | 435 Respond(true); |
466 } | 436 } |
467 | 437 |
468 FileBrowserPrivateSetLastModifiedFunction:: | |
469 FileBrowserPrivateSetLastModifiedFunction() { | |
470 } | |
471 | |
472 FileBrowserPrivateSetLastModifiedFunction:: | |
473 ~FileBrowserPrivateSetLastModifiedFunction() { | |
474 } | |
475 | |
476 bool FileBrowserPrivateSetLastModifiedFunction::RunImpl() { | 438 bool FileBrowserPrivateSetLastModifiedFunction::RunImpl() { |
477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 439 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
478 | 440 using extensions::api::file_browser_private::SetLastModified::Params; |
479 if (args_->GetSize() != 2) { | 441 const scoped_ptr<Params> params(Params::Create(*args_)); |
480 return false; | 442 EXTENSION_FUNCTION_VALIDATE(params); |
481 } | |
482 | |
483 std::string file_url; | |
484 if (!args_->GetString(0, &file_url)) | |
485 return false; | |
486 | |
487 std::string timestamp; | |
488 if (!args_->GetString(1, ×tamp)) | |
489 return false; | |
490 | 443 |
491 base::FilePath local_path = file_manager::util::GetLocalPathFromURL( | 444 base::FilePath local_path = file_manager::util::GetLocalPathFromURL( |
492 render_view_host(), profile(), GURL(file_url)); | 445 render_view_host(), profile(), GURL(params->file_url)); |
493 | 446 |
494 base::PostTaskAndReplyWithResult( | 447 base::PostTaskAndReplyWithResult( |
495 BrowserThread::GetBlockingPool(), | 448 BrowserThread::GetBlockingPool(), |
496 FROM_HERE, | 449 FROM_HERE, |
497 base::Bind(&SetLastModifiedOnBlockingPool, | 450 base::Bind(&SetLastModifiedOnBlockingPool, |
498 local_path, | 451 local_path, |
499 strtoul(timestamp.c_str(), NULL, 0)), | 452 strtoul(params->last_modified.c_str(), NULL, 0)), |
500 base::Bind(&FileBrowserPrivateSetLastModifiedFunction::SendResponse, | 453 base::Bind(&FileBrowserPrivateSetLastModifiedFunction::SendResponse, |
501 this)); | 454 this)); |
502 return true; | 455 return true; |
503 } | 456 } |
504 | 457 |
505 FileBrowserPrivateGetSizeStatsFunction:: | |
506 FileBrowserPrivateGetSizeStatsFunction() { | |
507 } | |
508 | |
509 FileBrowserPrivateGetSizeStatsFunction:: | |
510 ~FileBrowserPrivateGetSizeStatsFunction() { | |
511 } | |
512 | |
513 bool FileBrowserPrivateGetSizeStatsFunction::RunImpl() { | 458 bool FileBrowserPrivateGetSizeStatsFunction::RunImpl() { |
514 if (args_->GetSize() != 1) { | 459 using extensions::api::file_browser_private::GetSizeStats::Params; |
515 return false; | 460 const scoped_ptr<Params> params(Params::Create(*args_)); |
516 } | 461 EXTENSION_FUNCTION_VALIDATE(params); |
517 | |
518 std::string mount_url; | |
519 if (!args_->GetString(0, &mount_url)) | |
520 return false; | |
521 | 462 |
522 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( | 463 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( |
523 render_view_host(), profile(), GURL(mount_url)); | 464 render_view_host(), profile(), GURL(params->mount_path)); |
kinaba
2013/09/12 07:34:19
This parameter should be URL.
Could you fix the .j
hirono
2013/09/17 01:21:20
It seems that the name of mountPath is used 6 time
| |
524 if (file_path.empty()) | 465 if (file_path.empty()) |
525 return false; | 466 return false; |
526 | 467 |
527 if (file_path == drive::util::GetDriveMountPointPath()) { | 468 if (file_path == drive::util::GetDriveMountPointPath()) { |
528 drive::FileSystemInterface* file_system = | 469 drive::FileSystemInterface* file_system = |
529 drive::util::GetFileSystemByProfile(profile()); | 470 drive::util::GetFileSystemByProfile(profile()); |
530 if (!file_system) { | 471 if (!file_system) { |
531 // |file_system| is NULL if Drive is disabled. | 472 // |file_system| is NULL if Drive is disabled. |
532 // If stats couldn't be gotten for drive, result should be left | 473 // If stats couldn't be gotten for drive, result should be left |
533 // undefined. See comments in GetDriveAvailableSpaceCallback(). | 474 // undefined. See comments in GetDriveAvailableSpaceCallback(). |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 const uint64* remaining_size) { | 518 const uint64* remaining_size) { |
578 base::DictionaryValue* sizes = new base::DictionaryValue(); | 519 base::DictionaryValue* sizes = new base::DictionaryValue(); |
579 SetResult(sizes); | 520 SetResult(sizes); |
580 | 521 |
581 sizes->SetDouble("totalSize", static_cast<double>(*total_size)); | 522 sizes->SetDouble("totalSize", static_cast<double>(*total_size)); |
582 sizes->SetDouble("remainingSize", static_cast<double>(*remaining_size)); | 523 sizes->SetDouble("remainingSize", static_cast<double>(*remaining_size)); |
583 | 524 |
584 SendResponse(true); | 525 SendResponse(true); |
585 } | 526 } |
586 | 527 |
587 FileBrowserPrivateGetVolumeMetadataFunction:: | |
588 FileBrowserPrivateGetVolumeMetadataFunction() { | |
589 } | |
590 | |
591 FileBrowserPrivateGetVolumeMetadataFunction:: | |
592 ~FileBrowserPrivateGetVolumeMetadataFunction() { | |
593 } | |
594 | |
595 bool FileBrowserPrivateGetVolumeMetadataFunction::RunImpl() { | 528 bool FileBrowserPrivateGetVolumeMetadataFunction::RunImpl() { |
596 if (args_->GetSize() != 1) { | 529 using extensions::api::file_browser_private::GetVolumeMetadata::Params; |
597 error_ = "Invalid argument count"; | 530 const scoped_ptr<Params> params(Params::Create(*args_)); |
598 return false; | 531 EXTENSION_FUNCTION_VALIDATE(params); |
599 } | |
600 | |
601 std::string volume_mount_url; | |
602 if (!args_->GetString(0, &volume_mount_url)) { | |
603 NOTREACHED(); | |
604 return false; | |
605 } | |
606 | 532 |
607 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( | 533 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( |
608 render_view_host(), profile(), GURL(volume_mount_url)); | 534 render_view_host(), profile(), GURL(params->mount_url)); |
609 if (file_path.empty()) { | 535 if (file_path.empty()) { |
610 error_ = "Invalid mount path."; | 536 error_ = "Invalid mount path."; |
611 return false; | 537 return false; |
612 } | 538 } |
613 | 539 |
614 results_.reset(); | 540 results_.reset(); |
615 | 541 |
616 base::FilePath home_path; | 542 base::FilePath home_path; |
617 // TODO(hidehiko): Return the volume info for Drive File System. | 543 // TODO(hidehiko): Return the volume info for Drive File System. |
618 if (PathService::Get(base::DIR_HOME, &home_path) && | 544 if (PathService::Get(base::DIR_HOME, &home_path) && |
619 file_path == home_path.AppendASCII("Downloads")) { | 545 file_path == home_path.AppendASCII("Downloads")) { |
620 // Return simple (fake) volume metadata for Downloads volume. | 546 // Return simple (fake) volume metadata for Downloads volume. |
621 SetResult(CreateDownloadsVolumeMetadata()); | 547 SetResult(CreateDownloadsVolumeMetadata()); |
622 } else { | 548 } else { |
623 const DiskMountManager::Disk* volume = GetVolumeAsDisk(file_path.value()); | 549 const DiskMountManager::Disk* volume = GetVolumeAsDisk(file_path.value()); |
624 if (volume) | 550 if (volume) |
625 SetResult(CreateValueFromDisk(profile_, extension_->id(), volume)); | 551 SetResult(CreateValueFromDisk(profile_, extension_->id(), volume)); |
626 } | 552 } |
627 | 553 |
628 SendResponse(true); | 554 SendResponse(true); |
629 return true; | 555 return true; |
630 } | 556 } |
631 | 557 |
632 FileBrowserPrivateValidatePathNameLengthFunction:: | |
633 FileBrowserPrivateValidatePathNameLengthFunction() { | |
634 } | |
635 | |
636 FileBrowserPrivateValidatePathNameLengthFunction:: | |
637 ~FileBrowserPrivateValidatePathNameLengthFunction() { | |
638 } | |
639 | |
640 bool FileBrowserPrivateValidatePathNameLengthFunction::RunImpl() { | 558 bool FileBrowserPrivateValidatePathNameLengthFunction::RunImpl() { |
641 std::string parent_url; | 559 using extensions::api::file_browser_private::ValidatePathNameLength::Params; |
642 if (!args_->GetString(0, &parent_url)) | 560 const scoped_ptr<Params> params(Params::Create(*args_)); |
643 return false; | 561 EXTENSION_FUNCTION_VALIDATE(params); |
644 | |
645 std::string name; | |
646 if (!args_->GetString(1, &name)) | |
647 return false; | |
648 | 562 |
649 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 563 scoped_refptr<fileapi::FileSystemContext> file_system_context = |
650 file_manager::util::GetFileSystemContextForRenderViewHost( | 564 file_manager::util::GetFileSystemContextForRenderViewHost( |
651 profile(), render_view_host()); | 565 profile(), render_view_host()); |
652 | 566 |
653 fileapi::FileSystemURL filesystem_url( | 567 fileapi::FileSystemURL filesystem_url( |
654 file_system_context->CrackURL(GURL(parent_url))); | 568 file_system_context->CrackURL(GURL(params->parent_directory_url))); |
655 if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) | 569 if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) |
656 return false; | 570 return false; |
657 | 571 |
658 // No explicit limit on the length of Drive file names. | 572 // No explicit limit on the length of Drive file names. |
659 if (filesystem_url.type() == fileapi::kFileSystemTypeDrive) { | 573 if (filesystem_url.type() == fileapi::kFileSystemTypeDrive) { |
660 SetResult(new base::FundamentalValue(true)); | 574 SetResult(new base::FundamentalValue(true)); |
661 SendResponse(true); | 575 SendResponse(true); |
662 return true; | 576 return true; |
663 } | 577 } |
664 | 578 |
665 base::PostTaskAndReplyWithResult( | 579 base::PostTaskAndReplyWithResult( |
666 BrowserThread::GetBlockingPool(), | 580 BrowserThread::GetBlockingPool(), |
667 FROM_HERE, | 581 FROM_HERE, |
668 base::Bind(&GetFileNameMaxLengthOnBlockingPool, | 582 base::Bind(&GetFileNameMaxLengthOnBlockingPool, |
669 filesystem_url.path().AsUTF8Unsafe()), | 583 filesystem_url.path().AsUTF8Unsafe()), |
670 base::Bind(&FileBrowserPrivateValidatePathNameLengthFunction:: | 584 base::Bind(&FileBrowserPrivateValidatePathNameLengthFunction:: |
671 OnFilePathLimitRetrieved, | 585 OnFilePathLimitRetrieved, |
672 this, name.size())); | 586 this, params->name.size())); |
673 return true; | 587 return true; |
674 } | 588 } |
675 | 589 |
676 void FileBrowserPrivateValidatePathNameLengthFunction::OnFilePathLimitRetrieved( | 590 void FileBrowserPrivateValidatePathNameLengthFunction::OnFilePathLimitRetrieved( |
677 size_t current_length, | 591 size_t current_length, |
678 size_t max_length) { | 592 size_t max_length) { |
679 SetResult(new base::FundamentalValue(current_length <= max_length)); | 593 SetResult(new base::FundamentalValue(current_length <= max_length)); |
680 SendResponse(true); | 594 SendResponse(true); |
681 } | 595 } |
682 | 596 |
683 FileBrowserPrivateFormatDeviceFunction:: | |
684 FileBrowserPrivateFormatDeviceFunction() { | |
685 } | |
686 | |
687 FileBrowserPrivateFormatDeviceFunction:: | |
688 ~FileBrowserPrivateFormatDeviceFunction() { | |
689 } | |
690 | |
691 bool FileBrowserPrivateFormatDeviceFunction::RunImpl() { | 597 bool FileBrowserPrivateFormatDeviceFunction::RunImpl() { |
692 if (args_->GetSize() != 1) { | 598 using extensions::api::file_browser_private::FormatDevice::Params; |
693 return false; | 599 const scoped_ptr<Params> params(Params::Create(*args_)); |
694 } | 600 EXTENSION_FUNCTION_VALIDATE(params); |
695 | |
696 std::string volume_file_url; | |
697 if (!args_->GetString(0, &volume_file_url)) { | |
698 NOTREACHED(); | |
699 return false; | |
700 } | |
701 | 601 |
702 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( | 602 base::FilePath file_path = file_manager::util::GetLocalPathFromURL( |
703 render_view_host(), profile(), GURL(volume_file_url)); | 603 render_view_host(), profile(), GURL(params->mount_path)); |
kinaba
2013/09/12 07:34:19
ditto.
| |
704 if (file_path.empty()) | 604 if (file_path.empty()) |
705 return false; | 605 return false; |
706 | 606 |
707 DiskMountManager::GetInstance()->FormatMountedDevice(file_path.value()); | 607 DiskMountManager::GetInstance()->FormatMountedDevice(file_path.value()); |
708 SendResponse(true); | 608 SendResponse(true); |
709 return true; | 609 return true; |
710 } | 610 } |
711 | 611 |
712 FileBrowserPrivateStartCopyFunction::FileBrowserPrivateStartCopyFunction() { | |
713 } | |
714 | |
715 FileBrowserPrivateStartCopyFunction::~FileBrowserPrivateStartCopyFunction() { | |
716 } | |
717 | |
718 bool FileBrowserPrivateStartCopyFunction::RunImpl() { | 612 bool FileBrowserPrivateStartCopyFunction::RunImpl() { |
719 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 613 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
720 | 614 |
721 using extensions::api::file_browser_private::StartCopy::Params; | 615 using extensions::api::file_browser_private::StartCopy::Params; |
722 const scoped_ptr<Params> params(Params::Create(*args_)); | 616 const scoped_ptr<Params> params(Params::Create(*args_)); |
723 EXTENSION_FUNCTION_VALIDATE(params); | 617 EXTENSION_FUNCTION_VALIDATE(params); |
724 | 618 |
725 if (params->source_url.empty() || params->parent.empty() || | 619 if (params->source_url.empty() || params->parent.empty() || |
726 params->new_name.empty()) { | 620 params->new_name.empty()) { |
727 error_ = base::IntToString(fileapi::PlatformFileErrorToWebFileError( | 621 error_ = base::IntToString(fileapi::PlatformFileErrorToWebFileError( |
(...skipping 26 matching lines...) Expand all Loading... | |
754 } | 648 } |
755 | 649 |
756 void FileBrowserPrivateStartCopyFunction::RunAfterStartCopy( | 650 void FileBrowserPrivateStartCopyFunction::RunAfterStartCopy( |
757 int operation_id) { | 651 int operation_id) { |
758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 652 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
759 | 653 |
760 SetResult(Value::CreateIntegerValue(operation_id)); | 654 SetResult(Value::CreateIntegerValue(operation_id)); |
761 SendResponse(true); | 655 SendResponse(true); |
762 } | 656 } |
763 | 657 |
764 FileBrowserPrivateCancelCopyFunction::FileBrowserPrivateCancelCopyFunction() { | |
765 } | |
766 | |
767 FileBrowserPrivateCancelCopyFunction::~FileBrowserPrivateCancelCopyFunction() { | |
768 } | |
769 | |
770 bool FileBrowserPrivateCancelCopyFunction::RunImpl() { | 658 bool FileBrowserPrivateCancelCopyFunction::RunImpl() { |
771 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 659 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
772 | 660 |
773 using extensions::api::file_browser_private::CancelCopy::Params; | 661 using extensions::api::file_browser_private::CancelCopy::Params; |
774 const scoped_ptr<Params> params(Params::Create(*args_)); | 662 const scoped_ptr<Params> params(Params::Create(*args_)); |
775 EXTENSION_FUNCTION_VALIDATE(params); | 663 EXTENSION_FUNCTION_VALIDATE(params); |
776 | 664 |
777 scoped_refptr<fileapi::FileSystemContext> file_system_context = | 665 scoped_refptr<fileapi::FileSystemContext> file_system_context = |
778 file_manager::util::GetFileSystemContextForRenderViewHost( | 666 file_manager::util::GetFileSystemContextForRenderViewHost( |
779 profile(), render_view_host()); | 667 profile(), render_view_host()); |
780 | 668 |
781 // We don't much take care about the result of cancellation. | 669 // We don't much take care about the result of cancellation. |
782 BrowserThread::PostTask( | 670 BrowserThread::PostTask( |
783 BrowserThread::IO, | 671 BrowserThread::IO, |
784 FROM_HERE, | 672 FROM_HERE, |
785 base::Bind(&CancelCopyOnIOThread, file_system_context, params->copy_id)); | 673 base::Bind(&CancelCopyOnIOThread, file_system_context, params->copy_id)); |
786 SendResponse(true); | 674 SendResponse(true); |
787 return true; | 675 return true; |
788 } | 676 } |
789 | 677 |
790 } // namespace extensions | 678 } // namespace extensions |
OLD | NEW |