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

Side by Side Diff: chrome/browser/chromeos/drive/file_system_proxy.cc

Issue 14671020: FileAPI: Copy base::FileUtilProxy::Entry to fileapi::DirectoryEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/chromeos/drive/file_system_proxy.h" 5 #include "chrome/browser/chromeos/drive/file_system_proxy.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 base::PlatformFileError truncate_result, 146 base::PlatformFileError truncate_result,
147 FileError close_result) { 147 FileError close_result) {
148 // Reports the first error. 148 // Reports the first error.
149 callback.Run(truncate_result == base::PLATFORM_FILE_OK ? 149 callback.Run(truncate_result == base::PLATFORM_FILE_OK ?
150 FileErrorToPlatformError(close_result) : 150 FileErrorToPlatformError(close_result) :
151 truncate_result); 151 truncate_result);
152 } 152 }
153 153
154 } // namespace 154 } // namespace
155 155
156 base::FileUtilProxy::Entry ResourceEntryToFileUtilProxyEntry( 156 FileSystemOperation::Entry ResourceEntryToFileSystemOperationEntry(
157 const ResourceEntry& resource_entry) { 157 const ResourceEntry& resource_entry) {
158 base::PlatformFileInfo file_info; 158 base::PlatformFileInfo file_info;
159 util::ConvertResourceEntryToPlatformFileInfo( 159 util::ConvertResourceEntryToPlatformFileInfo(
160 resource_entry.file_info(), &file_info); 160 resource_entry.file_info(), &file_info);
161 161
162 base::FileUtilProxy::Entry entry; 162 FileSystemOperation::Entry entry;
163 entry.name = resource_entry.base_name(); 163 entry.name = resource_entry.base_name();
164 entry.is_directory = file_info.is_directory; 164 entry.is_directory = file_info.is_directory;
165 entry.size = file_info.size; 165 entry.size = file_info.size;
166 entry.last_modified_time = file_info.last_modified; 166 entry.last_modified_time = file_info.last_modified;
167 return entry; 167 return entry;
168 } 168 }
169 169
170 // FileSystemProxy class implementation. 170 // FileSystemProxy class implementation.
171 171
172 FileSystemProxy::FileSystemProxy( 172 FileSystemProxy::FileSystemProxy(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 const FileSystemURL& file_url, 262 const FileSystemURL& file_url,
263 const FileSystemOperation::ReadDirectoryCallback& callback) { 263 const FileSystemOperation::ReadDirectoryCallback& callback) {
264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
265 265
266 base::FilePath file_path; 266 base::FilePath file_path;
267 if (!ValidateUrl(file_url, &file_path)) { 267 if (!ValidateUrl(file_url, &file_path)) {
268 base::MessageLoopProxy::current()->PostTask( 268 base::MessageLoopProxy::current()->PostTask(
269 FROM_HERE, 269 FROM_HERE,
270 base::Bind(callback, 270 base::Bind(callback,
271 base::PLATFORM_FILE_ERROR_NOT_FOUND, 271 base::PLATFORM_FILE_ERROR_NOT_FOUND,
272 std::vector<base::FileUtilProxy::Entry>(), 272 std::vector<FileSystemOperation::Entry>(),
273 false)); 273 false));
274 return; 274 return;
275 } 275 }
276 276
277 CallFileSystemMethodOnUIThread( 277 CallFileSystemMethodOnUIThread(
278 base::Bind(&FileSystemInterface::ReadDirectoryByPath, 278 base::Bind(&FileSystemInterface::ReadDirectoryByPath,
279 base::Unretained(file_system_), 279 base::Unretained(file_system_),
280 file_path, 280 file_path,
281 google_apis::CreateRelayCallback( 281 google_apis::CreateRelayCallback(
282 base::Bind(&FileSystemProxy::OnReadDirectory, 282 base::Bind(&FileSystemProxy::OnReadDirectory,
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 void FileSystemProxy::OnReadDirectory( 793 void FileSystemProxy::OnReadDirectory(
794 const FileSystemOperation::ReadDirectoryCallback& 794 const FileSystemOperation::ReadDirectoryCallback&
795 callback, 795 callback,
796 FileError error, 796 FileError error,
797 bool hide_hosted_documents, 797 bool hide_hosted_documents,
798 scoped_ptr<ResourceEntryVector> resource_entries) { 798 scoped_ptr<ResourceEntryVector> resource_entries) {
799 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 799 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
800 800
801 if (error != FILE_ERROR_OK) { 801 if (error != FILE_ERROR_OK) {
802 callback.Run(FileErrorToPlatformError(error), 802 callback.Run(FileErrorToPlatformError(error),
803 std::vector<base::FileUtilProxy::Entry>(), 803 std::vector<FileSystemOperation::Entry>(),
804 false); 804 false);
805 return; 805 return;
806 } 806 }
807 DCHECK(resource_entries.get()); 807 DCHECK(resource_entries.get());
808 808
809 std::vector<base::FileUtilProxy::Entry> entries; 809 std::vector<FileSystemOperation::Entry> entries;
810 // Convert Drive files to something File API stack can understand. 810 // Convert Drive files to something File API stack can understand.
811 for (size_t i = 0; i < resource_entries->size(); ++i) { 811 for (size_t i = 0; i < resource_entries->size(); ++i) {
812 const ResourceEntry& resource_entry = (*resource_entries)[i]; 812 const ResourceEntry& resource_entry = (*resource_entries)[i];
813 if (resource_entry.has_file_specific_info() && 813 if (resource_entry.has_file_specific_info() &&
814 resource_entry.file_specific_info().is_hosted_document() && 814 resource_entry.file_specific_info().is_hosted_document() &&
815 hide_hosted_documents) { 815 hide_hosted_documents) {
816 continue; 816 continue;
817 } 817 }
818 entries.push_back(ResourceEntryToFileUtilProxyEntry(resource_entry)); 818 entries.push_back(ResourceEntryToFileSystemOperationEntry(resource_entry));
819 } 819 }
820 820
821 callback.Run(base::PLATFORM_FILE_OK, entries, false); 821 callback.Run(base::PLATFORM_FILE_OK, entries, false);
822 } 822 }
823 823
824 void FileSystemProxy::OnCreateWritableSnapshotFile( 824 void FileSystemProxy::OnCreateWritableSnapshotFile(
825 const base::FilePath& virtual_path, 825 const base::FilePath& virtual_path,
826 const fileapi::WritableSnapshotFile& callback, 826 const fileapi::WritableSnapshotFile& callback,
827 FileError result, 827 FileError result,
828 const base::FilePath& local_path) { 828 const base::FilePath& local_path) {
(...skipping 28 matching lines...) Expand all
857 base::Bind(&EmitDebugLogForCloseFile, 857 base::Bind(&EmitDebugLogForCloseFile,
858 virtual_path)))); 858 virtual_path))));
859 } 859 }
860 860
861 FileSystemInterface* FileSystemProxy::GetFileSystemOnUIThread() { 861 FileSystemInterface* FileSystemProxy::GetFileSystemOnUIThread() {
862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
863 return file_system_; 863 return file_system_;
864 } 864 }
865 865
866 } // namespace drive 866 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698