| OLD | NEW |
| 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 file_flags, | 512 file_flags, |
| 513 peer_handle, | 513 peer_handle, |
| 514 callback)); | 514 callback)); |
| 515 } else { | 515 } else { |
| 516 // Read-only file open. | 516 // Read-only file open. |
| 517 file_system_->GetFileByPath(file_path, | 517 file_system_->GetFileByPath(file_path, |
| 518 base::Bind(&OnGetFileByPathForOpen, | 518 base::Bind(&OnGetFileByPathForOpen, |
| 519 callback, | 519 callback, |
| 520 file_flags, | 520 file_flags, |
| 521 peer_handle), | 521 peer_handle), |
| 522 GetDownloadDataCallback()); | 522 GetContentCallback()); |
| 523 } | 523 } |
| 524 } else if ((file_flags & base::PLATFORM_FILE_CREATE) || | 524 } else if ((file_flags & base::PLATFORM_FILE_CREATE) || |
| 525 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS)) { | 525 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS)) { |
| 526 // Open existing file for writing. | 526 // Open existing file for writing. |
| 527 file_system_->CreateFile( | 527 file_system_->CreateFile( |
| 528 file_path, | 528 file_path, |
| 529 file_flags & base::PLATFORM_FILE_EXCLUSIVE_WRITE, | 529 file_flags & base::PLATFORM_FILE_EXCLUSIVE_WRITE, |
| 530 base::Bind(&GDataFileSystemProxy::OnCreateFileForOpen, | 530 base::Bind(&GDataFileSystemProxy::OnCreateFileForOpen, |
| 531 this, | 531 this, |
| 532 file_path, | 532 file_path, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 | 594 |
| 595 base::PlatformFileInfo file_info; | 595 base::PlatformFileInfo file_info; |
| 596 GDataEntry::ConvertProtoToPlatformFileInfo( | 596 GDataEntry::ConvertProtoToPlatformFileInfo( |
| 597 entry_proto->file_info(), | 597 entry_proto->file_info(), |
| 598 &file_info); | 598 &file_info); |
| 599 | 599 |
| 600 file_system_->GetFileByPath(entry_path, | 600 file_system_->GetFileByPath(entry_path, |
| 601 base::Bind(&CallSnapshotFileCallback, | 601 base::Bind(&CallSnapshotFileCallback, |
| 602 callback, | 602 callback, |
| 603 file_info), | 603 file_info), |
| 604 GetDownloadDataCallback()); | 604 GetContentCallback()); |
| 605 } | 605 } |
| 606 | 606 |
| 607 void GDataFileSystemProxy::CreateWritableSnapshotFile( | 607 void GDataFileSystemProxy::CreateWritableSnapshotFile( |
| 608 const FileSystemURL& file_url, | 608 const FileSystemURL& file_url, |
| 609 const fileapi::WritableSnapshotFile& callback) { | 609 const fileapi::WritableSnapshotFile& callback) { |
| 610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 611 | 611 |
| 612 FilePath file_path; | 612 FilePath file_path; |
| 613 if (!ValidateUrl(file_url, &file_path)) { | 613 if (!ValidateUrl(file_url, &file_path)) { |
| 614 MessageLoopProxy::current()->PostTask(FROM_HERE, | 614 MessageLoopProxy::current()->PostTask(FROM_HERE, |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 729 |
| 730 void GDataFileSystemProxy::CloseWritableSnapshotFile( | 730 void GDataFileSystemProxy::CloseWritableSnapshotFile( |
| 731 const FilePath& virtual_path, | 731 const FilePath& virtual_path, |
| 732 const FilePath& local_path) { | 732 const FilePath& local_path) { |
| 733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 734 | 734 |
| 735 file_system_->CloseFile(virtual_path, base::Bind(&OnClose, virtual_path)); | 735 file_system_->CloseFile(virtual_path, base::Bind(&OnClose, virtual_path)); |
| 736 } | 736 } |
| 737 | 737 |
| 738 } // namespace gdata | 738 } // namespace gdata |
| OLD | NEW |