| 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 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_PROXY_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/gdata/drive_file_system_interface.h" |
| 8 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 9 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 9 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" | |
| 10 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" | 10 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" |
| 11 | 11 |
| 12 namespace fileapi { | 12 namespace fileapi { |
| 13 class FileSystemURL; | 13 class FileSystemURL; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace gdata { | 16 namespace gdata { |
| 17 | 17 |
| 18 class DriveEntryProto; | 18 class DriveEntryProto; |
| 19 class GDataFileSystemInterface; | 19 class DriveFileSystemInterface; |
| 20 | 20 |
| 21 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; | 21 typedef std::vector<DriveEntryProto> DriveEntryProtoVector; |
| 22 | 22 |
| 23 // Implementation of File API's remote file system proxy for GData file system. | 23 // Implementation of File API's remote file system proxy for Drive file system. |
| 24 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { | 24 class DriveFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { |
| 25 public: | 25 public: |
| 26 // |file_system| is the GDataFileSystem instance owned by GDataSystemService. | 26 // |file_system| is the DriveFileSystem instance owned by GDataSystemService. |
| 27 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system); | 27 explicit DriveFileSystemProxy(DriveFileSystemInterface* file_system); |
| 28 | 28 |
| 29 // fileapi::RemoteFileSystemProxyInterface overrides. | 29 // fileapi::RemoteFileSystemProxyInterface overrides. |
| 30 virtual void GetFileInfo( | 30 virtual void GetFileInfo( |
| 31 const fileapi::FileSystemURL& url, | 31 const fileapi::FileSystemURL& url, |
| 32 const fileapi::FileSystemOperationInterface::GetMetadataCallback& | 32 const fileapi::FileSystemOperationInterface::GetMetadataCallback& |
| 33 callback) OVERRIDE; | 33 callback) OVERRIDE; |
| 34 virtual void Copy( | 34 virtual void Copy( |
| 35 const fileapi::FileSystemURL& src_url, | 35 const fileapi::FileSystemURL& src_url, |
| 36 const fileapi::FileSystemURL& dest_url, | 36 const fileapi::FileSystemURL& dest_url, |
| 37 const fileapi::FileSystemOperationInterface::StatusCallback& callback) | 37 const fileapi::FileSystemOperationInterface::StatusCallback& callback) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void OpenFile( | 73 virtual void OpenFile( |
| 74 const fileapi::FileSystemURL& url, | 74 const fileapi::FileSystemURL& url, |
| 75 int file_flags, | 75 int file_flags, |
| 76 base::ProcessHandle peer_handle, | 76 base::ProcessHandle peer_handle, |
| 77 const fileapi::FileSystemOperationInterface::OpenFileCallback& | 77 const fileapi::FileSystemOperationInterface::OpenFileCallback& |
| 78 callback) OVERRIDE; | 78 callback) OVERRIDE; |
| 79 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; | 79 virtual void NotifyCloseFile(const fileapi::FileSystemURL& url) OVERRIDE; |
| 80 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. | 80 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~GDataFileSystemProxy(); | 83 virtual ~DriveFileSystemProxy(); |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 // Checks if a given |url| belongs to this file system. If it does, | 86 // Checks if a given |url| belongs to this file system. If it does, |
| 87 // the call will return true and fill in |file_path| with a file path of | 87 // the call will return true and fill in |file_path| with a file path of |
| 88 // a corresponding element within this file system. | 88 // a corresponding element within this file system. |
| 89 static bool ValidateUrl(const fileapi::FileSystemURL& url, | 89 static bool ValidateUrl(const fileapi::FileSystemURL& url, |
| 90 FilePath* file_path); | 90 FilePath* file_path); |
| 91 | 91 |
| 92 // Helper callback for relaying reply for status callbacks to the | 92 // Helper callback for relaying reply for status callbacks to the |
| 93 // calling thread. | 93 // calling thread. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED | 174 // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED |
| 175 // flag is set. This is called when the truncation of a local cache file is | 175 // flag is set. This is called when the truncation of a local cache file is |
| 176 // finished on FILE thread. | 176 // finished on FILE thread. |
| 177 void OnOpenAndTruncate( | 177 void OnOpenAndTruncate( |
| 178 base::ProcessHandle peer_handle, | 178 base::ProcessHandle peer_handle, |
| 179 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, | 179 const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, |
| 180 base::PlatformFile* platform_file, | 180 base::PlatformFile* platform_file, |
| 181 base::PlatformFileError* truncate_result); | 181 base::PlatformFileError* truncate_result); |
| 182 | 182 |
| 183 // GDataFileSystem is owned by Profile, which outlives GDataFileSystemProxy, | 183 // DriveFileSystem is owned by Profile, which outlives DriveFileSystemProxy, |
| 184 // which is owned by CrosMountPointProvider (i.e. by the time Profile is | 184 // which is owned by CrosMountPointProvider (i.e. by the time Profile is |
| 185 // removed, the file manager is already gone). Hence it's safe to use this as | 185 // removed, the file manager is already gone). Hence it's safe to use this as |
| 186 // a raw pointer. | 186 // a raw pointer. |
| 187 GDataFileSystemInterface* file_system_; | 187 DriveFileSystemInterface* file_system_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace chromeos | 190 } // namespace chromeos |
| 191 | 191 |
| 192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 192 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_FILE_SYSTEM_PROXY_H_ |
| OLD | NEW |