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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc

Issue 10877006: Rename GDataErrorCode to DriveErrorCode, GDataFileError to DriveFileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor local variable name fix. Created 8 years, 4 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/gdata/gdata_file_system_proxy.h" 5 #include "chrome/browser/chromeos/gdata/gdata_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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::PlatformFileError* open_error) { 57 base::PlatformFileError* open_error) {
58 callback.Run(*open_error, *platform_file, peer_handle); 58 callback.Run(*open_error, *platform_file, peer_handle);
59 } 59 }
60 60
61 // Helper function to run OpenFileCallback from 61 // Helper function to run OpenFileCallback from
62 // GDataFileSystemProxy::OpenFile(). 62 // GDataFileSystemProxy::OpenFile().
63 void OnGetFileByPathForOpen( 63 void OnGetFileByPathForOpen(
64 const FileSystemOperationInterface::OpenFileCallback& callback, 64 const FileSystemOperationInterface::OpenFileCallback& callback,
65 int file_flags, 65 int file_flags,
66 base::ProcessHandle peer_handle, 66 base::ProcessHandle peer_handle,
67 GDataFileError gdata_error, 67 DriveFileError file_error,
68 const FilePath& local_path, 68 const FilePath& local_path,
69 const std::string& unused_mime_type, 69 const std::string& unused_mime_type,
70 DriveFileType file_type) { 70 DriveFileType file_type) {
71 base::PlatformFileError error = 71 base::PlatformFileError error =
72 util::GDataFileErrorToPlatformError(gdata_error); 72 util::DriveFileErrorToPlatformError(file_error);
73 if (error != base::PLATFORM_FILE_OK) { 73 if (error != base::PLATFORM_FILE_OK) {
74 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); 74 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle);
75 return; 75 return;
76 } 76 }
77 77
78 base::PlatformFile* platform_file = new base::PlatformFile( 78 base::PlatformFile* platform_file = new base::PlatformFile(
79 base::kInvalidPlatformFileValue); 79 base::kInvalidPlatformFileValue);
80 base::PlatformFileError* open_error = 80 base::PlatformFileError* open_error =
81 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED); 81 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
82 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, 82 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE,
83 base::Bind(&OpenPlatformFileOnIOPool, 83 base::Bind(&OpenPlatformFileOnIOPool,
84 local_path, 84 local_path,
85 file_flags, 85 file_flags,
86 platform_file, 86 platform_file,
87 open_error), 87 open_error),
88 base::Bind(&OnPlatformFileOpened, 88 base::Bind(&OnPlatformFileOpened,
89 callback, 89 callback,
90 peer_handle, 90 peer_handle,
91 base::Owned(platform_file), 91 base::Owned(platform_file),
92 base::Owned(open_error))); 92 base::Owned(open_error)));
93 } 93 }
94 94
95 // Helper function to run SnapshotFileCallback from 95 // Helper function to run SnapshotFileCallback from
96 // GDataFileSystemProxy::CreateSnapshotFile(). 96 // GDataFileSystemProxy::CreateSnapshotFile().
97 void CallSnapshotFileCallback( 97 void CallSnapshotFileCallback(
98 const FileSystemOperationInterface::SnapshotFileCallback& callback, 98 const FileSystemOperationInterface::SnapshotFileCallback& callback,
99 const base::PlatformFileInfo& file_info, 99 const base::PlatformFileInfo& file_info,
100 GDataFileError gdata_error, 100 DriveFileError file_error,
101 const FilePath& local_path, 101 const FilePath& local_path,
102 const std::string& unused_mime_type, 102 const std::string& unused_mime_type,
103 DriveFileType file_type) { 103 DriveFileType file_type) {
104 scoped_refptr<ShareableFileReference> file_ref; 104 scoped_refptr<ShareableFileReference> file_ref;
105 base::PlatformFileError error = 105 base::PlatformFileError error =
106 util::GDataFileErrorToPlatformError(gdata_error); 106 util::DriveFileErrorToPlatformError(file_error);
107 107
108 // If the file is a hosted document, a temporary JSON file is created to 108 // If the file is a hosted document, a temporary JSON file is created to
109 // represent the document. The JSON file is not cached and its lifetime 109 // represent the document. The JSON file is not cached and its lifetime
110 // is managed by ShareableFileReference. 110 // is managed by ShareableFileReference.
111 if (error == base::PLATFORM_FILE_OK && file_type == HOSTED_DOCUMENT) { 111 if (error == base::PLATFORM_FILE_OK && file_type == HOSTED_DOCUMENT) {
112 file_ref = ShareableFileReference::GetOrCreate( 112 file_ref = ShareableFileReference::GetOrCreate(
113 local_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE, 113 local_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
114 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 114 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
115 } 115 }
116 116
117 // When reading file, last modified time specified in file info will be 117 // When reading file, last modified time specified in file info will be
118 // compared to the last modified time of the local version of the drive file. 118 // compared to the last modified time of the local version of the drive file.
119 // Since those two values don't generally match (last modification time on the 119 // Since those two values don't generally match (last modification time on the
120 // drive server vs. last modification time of the local, downloaded file), so 120 // drive server vs. last modification time of the local, downloaded file), so
121 // we have to opt out from this check. We do this by unsetting last_modified 121 // we have to opt out from this check. We do this by unsetting last_modified
122 // value in the file info passed to the CreateSnapshot caller. 122 // value in the file info passed to the CreateSnapshot caller.
123 base::PlatformFileInfo final_file_info(file_info); 123 base::PlatformFileInfo final_file_info(file_info);
124 final_file_info.last_modified = base::Time(); 124 final_file_info.last_modified = base::Time();
125 125
126 callback.Run(error, final_file_info, local_path, file_ref); 126 callback.Run(error, final_file_info, local_path, file_ref);
127 } 127 }
128 128
129 // Emits debug log when GDataFileSystem::CloseFile() is complete. 129 // Emits debug log when GDataFileSystem::CloseFile() is complete.
130 void EmitDebugLogForCloseFile(const FilePath& local_path, 130 void EmitDebugLogForCloseFile(const FilePath& local_path,
131 GDataFileError error_code) { 131 DriveFileError error_code) {
132 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code; 132 DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code;
133 } 133 }
134 134
135 void DoTruncateOnFileThread( 135 void DoTruncateOnFileThread(
136 const FilePath& local_cache_path, 136 const FilePath& local_cache_path,
137 int64 length, 137 int64 length,
138 base::PlatformFileError* result) { 138 base::PlatformFileError* result) {
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
140 140
141 base::PlatformFile file = base::CreatePlatformFile( 141 base::PlatformFile file = base::CreatePlatformFile(
142 local_cache_path, 142 local_cache_path,
143 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE, 143 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
144 NULL, 144 NULL,
145 result); 145 result);
146 if (*result == base::PLATFORM_FILE_OK) { 146 if (*result == base::PLATFORM_FILE_OK) {
147 DCHECK_NE(base::kInvalidPlatformFileValue, file); 147 DCHECK_NE(base::kInvalidPlatformFileValue, file);
148 if (!base::TruncatePlatformFile(file, length)) 148 if (!base::TruncatePlatformFile(file, length))
149 *result = base::PLATFORM_FILE_ERROR_FAILED; 149 *result = base::PLATFORM_FILE_ERROR_FAILED;
150 base::ClosePlatformFile(file); 150 base::ClosePlatformFile(file);
151 } 151 }
152 } 152 }
153 153
154 void DidCloseFileForTruncate( 154 void DidCloseFileForTruncate(
155 const FileSystemOperationInterface::StatusCallback& callback, 155 const FileSystemOperationInterface::StatusCallback& callback,
156 base::PlatformFileError truncate_result, 156 base::PlatformFileError truncate_result,
157 GDataFileError close_result) { 157 DriveFileError close_result) {
158 // Reports the first error. 158 // Reports the first error.
159 callback.Run(truncate_result == base::PLATFORM_FILE_OK ? 159 callback.Run(truncate_result == base::PLATFORM_FILE_OK ?
160 util::GDataFileErrorToPlatformError(close_result) : 160 util::DriveFileErrorToPlatformError(close_result) :
161 truncate_result); 161 truncate_result);
162 } 162 }
163 163
164 } // namespace 164 } // namespace
165 165
166 base::FileUtilProxy::Entry DriveEntryProtoToFileUtilProxyEntry( 166 base::FileUtilProxy::Entry DriveEntryProtoToFileUtilProxyEntry(
167 const DriveEntryProto& proto) { 167 const DriveEntryProto& proto) {
168 base::PlatformFileInfo file_info; 168 base::PlatformFileInfo file_info;
169 DriveEntry::ConvertProtoToPlatformFileInfo(proto.file_info(), &file_info); 169 DriveEntry::ConvertProtoToPlatformFileInfo(proto.file_info(), &file_info);
170 170
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 this, 351 this,
352 file_path, 352 file_path,
353 length, 353 length,
354 callback)); 354 callback));
355 } 355 }
356 356
357 void GDataFileSystemProxy::OnOpenFileForWriting( 357 void GDataFileSystemProxy::OnOpenFileForWriting(
358 int file_flags, 358 int file_flags,
359 base::ProcessHandle peer_handle, 359 base::ProcessHandle peer_handle,
360 const FileSystemOperationInterface::OpenFileCallback& callback, 360 const FileSystemOperationInterface::OpenFileCallback& callback,
361 GDataFileError gdata_error, 361 DriveFileError file_error,
362 const FilePath& local_cache_path) { 362 const FilePath& local_cache_path) {
363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 363 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
364 364
365 base::PlatformFileError error = 365 base::PlatformFileError error =
366 util::GDataFileErrorToPlatformError(gdata_error); 366 util::DriveFileErrorToPlatformError(file_error);
367 367
368 if (error != base::PLATFORM_FILE_OK) { 368 if (error != base::PLATFORM_FILE_OK) {
369 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); 369 callback.Run(error, base::kInvalidPlatformFileValue, peer_handle);
370 return; 370 return;
371 } 371 }
372 372
373 // Cache file prepared for modification is available. Truncate it. 373 // Cache file prepared for modification is available. Truncate it.
374 // File operation must be done on FILE thread, so relay the operation. 374 // File operation must be done on FILE thread, so relay the operation.
375 base::PlatformFileError* result = 375 base::PlatformFileError* result =
376 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED); 376 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
(...skipping 11 matching lines...) Expand all
388 base::Owned(platform_file), 388 base::Owned(platform_file),
389 base::Owned(result))); 389 base::Owned(result)));
390 DCHECK(posted); 390 DCHECK(posted);
391 } 391 }
392 392
393 void GDataFileSystemProxy::OnCreateFileForOpen( 393 void GDataFileSystemProxy::OnCreateFileForOpen(
394 const FilePath& file_path, 394 const FilePath& file_path,
395 int file_flags, 395 int file_flags,
396 base::ProcessHandle peer_handle, 396 base::ProcessHandle peer_handle,
397 const FileSystemOperationInterface::OpenFileCallback& callback, 397 const FileSystemOperationInterface::OpenFileCallback& callback,
398 GDataFileError gdata_error) { 398 DriveFileError file_error) {
399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 399 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
400 base::PlatformFileError create_result = 400 base::PlatformFileError create_result =
401 util::GDataFileErrorToPlatformError(gdata_error); 401 util::DriveFileErrorToPlatformError(file_error);
402 402
403 if ((create_result == base::PLATFORM_FILE_OK) || 403 if ((create_result == base::PLATFORM_FILE_OK) ||
404 ((create_result == base::PLATFORM_FILE_ERROR_EXISTS) && 404 ((create_result == base::PLATFORM_FILE_ERROR_EXISTS) &&
405 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS))) { 405 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS))) {
406 // If we are trying to always create an existing file, then 406 // If we are trying to always create an existing file, then
407 // if it really exists open it as truncated. 407 // if it really exists open it as truncated.
408 file_flags &= ~base::PLATFORM_FILE_CREATE; 408 file_flags &= ~base::PLATFORM_FILE_CREATE;
409 file_flags &= ~base::PLATFORM_FILE_CREATE_ALWAYS; 409 file_flags &= ~base::PLATFORM_FILE_CREATE_ALWAYS;
410 file_flags |= base::PLATFORM_FILE_OPEN_TRUNCATED; 410 file_flags |= base::PLATFORM_FILE_OPEN_TRUNCATED;
411 } else { 411 } else {
412 callback.Run(create_result, base::kInvalidPlatformFileValue, peer_handle); 412 callback.Run(create_result, base::kInvalidPlatformFileValue, peer_handle);
413 return; 413 return;
414 } 414 }
415 415
416 // Open created (or existing) file for writing. 416 // Open created (or existing) file for writing.
417 file_system_->OpenFile( 417 file_system_->OpenFile(
418 file_path, 418 file_path,
419 base::Bind(&GDataFileSystemProxy::OnOpenFileForWriting, 419 base::Bind(&GDataFileSystemProxy::OnOpenFileForWriting,
420 this, 420 this,
421 file_flags, 421 file_flags,
422 peer_handle, 422 peer_handle,
423 callback)); 423 callback));
424 } 424 }
425 425
426 void GDataFileSystemProxy::OnFileOpenedForTruncate( 426 void GDataFileSystemProxy::OnFileOpenedForTruncate(
427 const FilePath& virtual_path, 427 const FilePath& virtual_path,
428 int64 length, 428 int64 length,
429 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 429 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
430 GDataFileError open_result, 430 DriveFileError open_result,
431 const FilePath& local_cache_path) { 431 const FilePath& local_cache_path) {
432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 432 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
433 433
434 if (open_result != GDATA_FILE_OK) { 434 if (open_result != DRIVE_FILE_OK) {
435 callback.Run(util::GDataFileErrorToPlatformError(open_result)); 435 callback.Run(util::DriveFileErrorToPlatformError(open_result));
436 return; 436 return;
437 } 437 }
438 438
439 // Cache file prepared for modification is available. Truncate it. 439 // Cache file prepared for modification is available. Truncate it.
440 // File operation must be done on FILE thread, so relay the operation. 440 // File operation must be done on FILE thread, so relay the operation.
441 base::PlatformFileError* result = 441 base::PlatformFileError* result =
442 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED); 442 new base::PlatformFileError(base::PLATFORM_FILE_ERROR_FAILED);
443 bool posted = BrowserThread::GetMessageLoopProxyForThread( 443 bool posted = BrowserThread::GetMessageLoopProxyForThread(
444 BrowserThread::FILE)->PostTaskAndReply( 444 BrowserThread::FILE)->PostTaskAndReply(
445 FROM_HERE, 445 FROM_HERE,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 file_path, 574 file_path,
575 base::Bind(&GDataFileSystemProxy::OnGetEntryInfoByPath, 575 base::Bind(&GDataFileSystemProxy::OnGetEntryInfoByPath,
576 this, 576 this,
577 file_path, 577 file_path,
578 callback)); 578 callback));
579 } 579 }
580 580
581 void GDataFileSystemProxy::OnGetEntryInfoByPath( 581 void GDataFileSystemProxy::OnGetEntryInfoByPath(
582 const FilePath& entry_path, 582 const FilePath& entry_path,
583 const FileSystemOperationInterface::SnapshotFileCallback& callback, 583 const FileSystemOperationInterface::SnapshotFileCallback& callback,
584 GDataFileError error, 584 DriveFileError error,
585 scoped_ptr<DriveEntryProto> entry_proto) { 585 scoped_ptr<DriveEntryProto> entry_proto) {
586 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 586 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
587 587
588 if (error != GDATA_FILE_OK || !entry_proto.get()) { 588 if (error != DRIVE_FILE_OK || !entry_proto.get()) {
589 MessageLoopProxy::current()->PostTask(FROM_HERE, 589 MessageLoopProxy::current()->PostTask(FROM_HERE,
590 base::Bind(callback, 590 base::Bind(callback,
591 base::PLATFORM_FILE_ERROR_NOT_FOUND, 591 base::PLATFORM_FILE_ERROR_NOT_FOUND,
592 base::PlatformFileInfo(), 592 base::PlatformFileInfo(),
593 FilePath(), 593 FilePath(),
594 scoped_refptr<ShareableFileReference>(NULL))); 594 scoped_refptr<ShareableFileReference>(NULL)));
595 return; 595 return;
596 } 596 }
597 597
598 base::PlatformFileInfo file_info; 598 base::PlatformFileInfo file_info;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 // what platform you're on. 641 // what platform you're on.
642 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { 642 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) {
643 return false; 643 return false;
644 } 644 }
645 *file_path = url.virtual_path(); 645 *file_path = url.virtual_path();
646 return true; 646 return true;
647 } 647 }
648 648
649 void GDataFileSystemProxy::OnStatusCallback( 649 void GDataFileSystemProxy::OnStatusCallback(
650 const fileapi::FileSystemOperationInterface::StatusCallback& callback, 650 const fileapi::FileSystemOperationInterface::StatusCallback& callback,
651 GDataFileError error) { 651 DriveFileError error) {
652 callback.Run(util::GDataFileErrorToPlatformError(error)); 652 callback.Run(util::DriveFileErrorToPlatformError(error));
653 } 653 }
654 654
655 void GDataFileSystemProxy::OnGetMetadata( 655 void GDataFileSystemProxy::OnGetMetadata(
656 const FilePath& file_path, 656 const FilePath& file_path,
657 const FileSystemOperationInterface::GetMetadataCallback& callback, 657 const FileSystemOperationInterface::GetMetadataCallback& callback,
658 GDataFileError error, 658 DriveFileError error,
659 scoped_ptr<DriveEntryProto> entry_proto) { 659 scoped_ptr<DriveEntryProto> entry_proto) {
660 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 660 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
661 661
662 if (error != GDATA_FILE_OK) { 662 if (error != DRIVE_FILE_OK) {
663 callback.Run(util::GDataFileErrorToPlatformError(error), 663 callback.Run(util::DriveFileErrorToPlatformError(error),
664 base::PlatformFileInfo(), 664 base::PlatformFileInfo(),
665 FilePath()); 665 FilePath());
666 return; 666 return;
667 } 667 }
668 DCHECK(entry_proto.get()); 668 DCHECK(entry_proto.get());
669 669
670 base::PlatformFileInfo file_info; 670 base::PlatformFileInfo file_info;
671 DriveEntry::ConvertProtoToPlatformFileInfo( 671 DriveEntry::ConvertProtoToPlatformFileInfo(
672 entry_proto->file_info(), 672 entry_proto->file_info(),
673 &file_info); 673 &file_info);
674 674
675 callback.Run(base::PLATFORM_FILE_OK, file_info, file_path); 675 callback.Run(base::PLATFORM_FILE_OK, file_info, file_path);
676 } 676 }
677 677
678 void GDataFileSystemProxy::OnReadDirectory( 678 void GDataFileSystemProxy::OnReadDirectory(
679 const FileSystemOperationInterface::ReadDirectoryCallback& 679 const FileSystemOperationInterface::ReadDirectoryCallback&
680 callback, 680 callback,
681 GDataFileError error, 681 DriveFileError error,
682 bool hide_hosted_documents, 682 bool hide_hosted_documents,
683 scoped_ptr<DriveEntryProtoVector> proto_entries) { 683 scoped_ptr<DriveEntryProtoVector> proto_entries) {
684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
685 685
686 if (error != GDATA_FILE_OK) { 686 if (error != DRIVE_FILE_OK) {
687 callback.Run(util::GDataFileErrorToPlatformError(error), 687 callback.Run(util::DriveFileErrorToPlatformError(error),
688 std::vector<base::FileUtilProxy::Entry>(), 688 std::vector<base::FileUtilProxy::Entry>(),
689 false); 689 false);
690 return; 690 return;
691 } 691 }
692 DCHECK(proto_entries.get()); 692 DCHECK(proto_entries.get());
693 693
694 std::vector<base::FileUtilProxy::Entry> entries; 694 std::vector<base::FileUtilProxy::Entry> entries;
695 // Convert gdata files to something File API stack can understand. 695 // Convert gdata files to something File API stack can understand.
696 for (size_t i = 0; i < proto_entries->size(); ++i) { 696 for (size_t i = 0; i < proto_entries->size(); ++i) {
697 const DriveEntryProto& proto = (*proto_entries)[i]; 697 const DriveEntryProto& proto = (*proto_entries)[i];
698 if (proto.has_file_specific_info() && 698 if (proto.has_file_specific_info() &&
699 proto.file_specific_info().is_hosted_document() && 699 proto.file_specific_info().is_hosted_document() &&
700 hide_hosted_documents) { 700 hide_hosted_documents) {
701 continue; 701 continue;
702 } 702 }
703 entries.push_back(DriveEntryProtoToFileUtilProxyEntry(proto)); 703 entries.push_back(DriveEntryProtoToFileUtilProxyEntry(proto));
704 } 704 }
705 705
706 callback.Run(base::PLATFORM_FILE_OK, entries, false); 706 callback.Run(base::PLATFORM_FILE_OK, entries, false);
707 } 707 }
708 708
709 void GDataFileSystemProxy::OnCreateWritableSnapshotFile( 709 void GDataFileSystemProxy::OnCreateWritableSnapshotFile(
710 const FilePath& virtual_path, 710 const FilePath& virtual_path,
711 const fileapi::WritableSnapshotFile& callback, 711 const fileapi::WritableSnapshotFile& callback,
712 GDataFileError result, 712 DriveFileError result,
713 const FilePath& local_path) { 713 const FilePath& local_path) {
714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
715 715
716 scoped_refptr<ShareableFileReference> file_ref; 716 scoped_refptr<ShareableFileReference> file_ref;
717 717
718 if (result == GDATA_FILE_OK) { 718 if (result == DRIVE_FILE_OK) {
719 file_ref = ShareableFileReference::GetOrCreate( 719 file_ref = ShareableFileReference::GetOrCreate(
720 local_path, 720 local_path,
721 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, 721 ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE,
722 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 722 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
723 file_ref->AddFinalReleaseCallback( 723 file_ref->AddFinalReleaseCallback(
724 base::Bind(&GDataFileSystemProxy::CloseWritableSnapshotFile, 724 base::Bind(&GDataFileSystemProxy::CloseWritableSnapshotFile,
725 this, 725 this,
726 virtual_path)); 726 virtual_path));
727 } 727 }
728 728
729 callback.Run( 729 callback.Run(
730 util::GDataFileErrorToPlatformError(result), local_path, file_ref); 730 util::DriveFileErrorToPlatformError(result), local_path, file_ref);
731 } 731 }
732 732
733 void GDataFileSystemProxy::CloseWritableSnapshotFile( 733 void GDataFileSystemProxy::CloseWritableSnapshotFile(
734 const FilePath& virtual_path, 734 const FilePath& virtual_path,
735 const FilePath& local_path) { 735 const FilePath& local_path) {
736 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 736 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
737 737
738 file_system_->CloseFile(virtual_path, 738 file_system_->CloseFile(virtual_path,
739 base::Bind(&EmitDebugLogForCloseFile, virtual_path)); 739 base::Bind(&EmitDebugLogForCloseFile, virtual_path));
740 } 740 }
741 741
742 } // namespace gdata 742 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_proxy.h ('k') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698