OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/file_util_proxy.h" | 5 #include "base/file_util_proxy.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 | 8 |
9 // TODO(jianli): Move the code from anonymous namespace to base namespace so | 9 // TODO(jianli): Move the code from anonymous namespace to base namespace so |
10 // that all of the base:: prefixes would be unnecessary. | 10 // that all of the base:: prefixes would be unnecessary. |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 | 740 |
741 // static | 741 // static |
742 bool FileUtilProxy::CreateTemporary( | 742 bool FileUtilProxy::CreateTemporary( |
743 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 743 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
744 CreateTemporaryCallback* callback) { | 744 CreateTemporaryCallback* callback) { |
745 return Start(FROM_HERE, message_loop_proxy, | 745 return Start(FROM_HERE, message_loop_proxy, |
746 new RelayCreateTemporary(message_loop_proxy, callback)); | 746 new RelayCreateTemporary(message_loop_proxy, callback)); |
747 } | 747 } |
748 | 748 |
749 // static | 749 // static |
750 bool FileUtilProxy::CreateDirectory( | |
751 scoped_refptr<MessageLoopProxy> message_loop_proxy, | |
752 const FilePath& file_path, | |
753 bool exclusive, | |
754 bool recursive, | |
755 StatusCallback* callback) { | |
756 return Start(FROM_HERE, message_loop_proxy, new RelayCreateDirectory( | |
757 file_path, exclusive, recursive, callback)); | |
758 } | |
759 | |
760 // static | |
761 bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 750 bool FileUtilProxy::Close(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
762 base::PlatformFile file_handle, | 751 base::PlatformFile file_handle, |
763 StatusCallback* callback) { | 752 StatusCallback* callback) { |
764 return Start(FROM_HERE, message_loop_proxy, | 753 return Start(FROM_HERE, message_loop_proxy, |
765 new RelayClose(file_handle, callback)); | 754 new RelayClose(file_handle, callback)); |
766 } | 755 } |
767 | 756 |
768 // static | 757 // static |
769 bool FileUtilProxy::EnsureFileExists( | 758 bool FileUtilProxy::EnsureFileExists( |
770 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 759 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
771 const FilePath& file_path, | 760 const FilePath& file_path, |
772 EnsureFileExistsCallback* callback) { | 761 EnsureFileExistsCallback* callback) { |
773 return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists( | 762 return Start(FROM_HERE, message_loop_proxy, new RelayEnsureFileExists( |
774 message_loop_proxy, file_path, callback)); | 763 message_loop_proxy, file_path, callback)); |
775 } | 764 } |
776 | 765 |
777 // static | 766 // Retrieves the information about a file. It is invalid to pass NULL for the |
778 bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 767 // callback. |
779 const FilePath& file_path, | 768 bool FileUtilProxy::GetFileInfo( |
780 bool recursive, | 769 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
781 StatusCallback* callback) { | 770 const FilePath& file_path, |
782 return Start(FROM_HERE, message_loop_proxy, | 771 GetFileInfoCallback* callback) { |
783 new RelayDelete(file_path, recursive, callback)); | 772 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo( |
| 773 file_path, callback)); |
784 } | 774 } |
785 | 775 |
786 // static | 776 // static |
| 777 bool FileUtilProxy::GetFileInfoFromPlatformFile( |
| 778 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 779 PlatformFile file, |
| 780 GetFileInfoCallback* callback) { |
| 781 return Start(FROM_HERE, message_loop_proxy, |
| 782 new RelayGetFileInfoFromPlatformFile(file, callback)); |
| 783 } |
| 784 |
| 785 // static |
| 786 bool FileUtilProxy::ReadDirectory( |
| 787 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 788 const FilePath& file_path, |
| 789 ReadDirectoryCallback* callback) { |
| 790 return Start(FROM_HERE, message_loop_proxy, new RelayReadDirectory( |
| 791 file_path, callback)); |
| 792 } |
| 793 |
| 794 // static |
| 795 bool FileUtilProxy::CreateDirectory( |
| 796 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
| 797 const FilePath& file_path, |
| 798 bool exclusive, |
| 799 bool recursive, |
| 800 StatusCallback* callback) { |
| 801 return Start(FROM_HERE, message_loop_proxy, new RelayCreateDirectory( |
| 802 file_path, exclusive, recursive, callback)); |
| 803 } |
| 804 |
| 805 // static |
787 bool FileUtilProxy::Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 806 bool FileUtilProxy::Copy(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
788 const FilePath& src_file_path, | 807 const FilePath& src_file_path, |
789 const FilePath& dest_file_path, | 808 const FilePath& dest_file_path, |
790 StatusCallback* callback) { | 809 StatusCallback* callback) { |
791 return Start(FROM_HERE, message_loop_proxy, | 810 return Start(FROM_HERE, message_loop_proxy, |
792 new RelayCopy(src_file_path, dest_file_path, callback)); | 811 new RelayCopy(src_file_path, dest_file_path, callback)); |
793 } | 812 } |
794 | 813 |
795 // static | 814 // static |
796 bool FileUtilProxy::Move(scoped_refptr<MessageLoopProxy> message_loop_proxy, | 815 bool FileUtilProxy::Move(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
797 const FilePath& src_file_path, | 816 const FilePath& src_file_path, |
798 const FilePath& dest_file_path, | 817 const FilePath& dest_file_path, |
799 StatusCallback* callback) { | 818 StatusCallback* callback) { |
800 return Start(FROM_HERE, message_loop_proxy, | 819 return Start(FROM_HERE, message_loop_proxy, |
801 new RelayMove(src_file_path, dest_file_path, callback)); | 820 new RelayMove(src_file_path, dest_file_path, callback)); |
802 } | 821 } |
803 | 822 |
804 // static | 823 // static |
805 bool FileUtilProxy::ReadDirectory( | 824 bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy, |
806 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 825 const FilePath& file_path, |
807 const FilePath& file_path, | 826 bool recursive, |
808 ReadDirectoryCallback* callback) { | 827 StatusCallback* callback) { |
809 return Start(FROM_HERE, message_loop_proxy, new RelayReadDirectory( | 828 return Start(FROM_HERE, message_loop_proxy, |
810 file_path, callback)); | 829 new RelayDelete(file_path, recursive, callback)); |
811 } | |
812 | |
813 // Retrieves the information about a file. It is invalid to pass NULL for the | |
814 // callback. | |
815 bool FileUtilProxy::GetFileInfo( | |
816 scoped_refptr<MessageLoopProxy> message_loop_proxy, | |
817 const FilePath& file_path, | |
818 GetFileInfoCallback* callback) { | |
819 return Start(FROM_HERE, message_loop_proxy, new RelayGetFileInfo( | |
820 file_path, callback)); | |
821 } | 830 } |
822 | 831 |
823 // static | 832 // static |
824 bool FileUtilProxy::RecursiveDelete( | 833 bool FileUtilProxy::RecursiveDelete( |
825 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 834 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
826 const FilePath& file_path, | 835 const FilePath& file_path, |
827 StatusCallback* callback) { | 836 StatusCallback* callback) { |
828 return Start(FROM_HERE, message_loop_proxy, | 837 return Start(FROM_HERE, message_loop_proxy, |
829 new RelayDelete(file_path, true, callback)); | 838 new RelayDelete(file_path, true, callback)); |
830 } | 839 } |
831 | 840 |
832 // static | 841 // static |
833 bool FileUtilProxy::GetFileInfoFromPlatformFile( | |
834 scoped_refptr<MessageLoopProxy> message_loop_proxy, | |
835 PlatformFile file, | |
836 GetFileInfoCallback* callback) { | |
837 return Start(FROM_HERE, message_loop_proxy, | |
838 new RelayGetFileInfoFromPlatformFile(file, callback)); | |
839 } | |
840 | |
841 // static | |
842 bool FileUtilProxy::Read( | 842 bool FileUtilProxy::Read( |
843 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 843 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
844 PlatformFile file, | 844 PlatformFile file, |
845 int64 offset, | 845 int64 offset, |
846 char* buffer, | 846 char* buffer, |
847 int bytes_to_read, | 847 int bytes_to_read, |
848 ReadWriteCallback* callback) { | 848 ReadWriteCallback* callback) { |
849 return Start(FROM_HERE, message_loop_proxy, | 849 return Start(FROM_HERE, message_loop_proxy, |
850 new RelayRead(file, offset, buffer, bytes_to_read, callback)); | 850 new RelayRead(file, offset, buffer, bytes_to_read, callback)); |
851 } | 851 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 908 |
909 // static | 909 // static |
910 bool FileUtilProxy::Flush( | 910 bool FileUtilProxy::Flush( |
911 scoped_refptr<MessageLoopProxy> message_loop_proxy, | 911 scoped_refptr<MessageLoopProxy> message_loop_proxy, |
912 PlatformFile file, | 912 PlatformFile file, |
913 StatusCallback* callback) { | 913 StatusCallback* callback) { |
914 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); | 914 return Start(FROM_HERE, message_loop_proxy, new RelayFlush(file, callback)); |
915 } | 915 } |
916 | 916 |
917 } // namespace base | 917 } // namespace base |
OLD | NEW |