| 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_GDATA_FILE_SYSTEM_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" | 9 #include "webkit/chromeos/fileapi/remote_file_system_proxy.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 | 12 |
| 13 namespace gdata { | 13 namespace gdata { |
| 14 | 14 |
| 15 class GDataEntry; | 15 class GDataEntry; |
| 16 class GDataEntryProto; | 16 class GDataEntryProto; |
| 17 class GDataDirectoryProto; | 17 class GDataDirectoryProto; |
| 18 class GDataFileSystemInterface; | 18 class GDataFileSystemInterface; |
| 19 | 19 |
| 20 // The interface class for remote file system proxy. | 20 // The interface class for remote file system proxy. |
| 21 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { | 21 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { |
| 22 public: | 22 public: |
| 23 // |profile| is used to create GDataFileSystem, which is a per-profile | 23 // |profile| is used to create GDataFileSystem, which is a per-profile |
| 24 // instance. | 24 // instance. |
| 25 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system); | 25 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system); |
| 26 virtual ~GDataFileSystemProxy(); | |
| 27 | 26 |
| 28 // fileapi::RemoteFileSystemProxyInterface overrides. | 27 // fileapi::RemoteFileSystemProxyInterface overrides. |
| 29 virtual void GetFileInfo(const GURL& path, | 28 virtual void GetFileInfo(const GURL& path, |
| 30 const fileapi::FileSystemOperationInterface::GetMetadataCallback& | 29 const fileapi::FileSystemOperationInterface::GetMetadataCallback& |
| 31 callback) OVERRIDE; | 30 callback) OVERRIDE; |
| 32 virtual void Copy(const GURL& src_path, const GURL& dest_path, | 31 virtual void Copy(const GURL& src_path, const GURL& dest_path, |
| 33 const fileapi::FileSystemOperationInterface::StatusCallback& callback) | 32 const fileapi::FileSystemOperationInterface::StatusCallback& callback) |
| 34 OVERRIDE; | 33 OVERRIDE; |
| 35 virtual void Move(const GURL& src_path, const GURL& dest_path, | 34 virtual void Move(const GURL& src_path, const GURL& dest_path, |
| 36 const fileapi::FileSystemOperationInterface::StatusCallback& callback) | 35 const fileapi::FileSystemOperationInterface::StatusCallback& callback) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 const GURL& path, | 57 const GURL& path, |
| 59 const fileapi::WritableSnapshotFile& callback) OVERRIDE; | 58 const fileapi::WritableSnapshotFile& callback) OVERRIDE; |
| 60 virtual void OpenFile( | 59 virtual void OpenFile( |
| 61 const GURL& path, | 60 const GURL& path, |
| 62 int file_flags, | 61 int file_flags, |
| 63 base::ProcessHandle peer_handle, | 62 base::ProcessHandle peer_handle, |
| 64 const fileapi::FileSystemOperationInterface::OpenFileCallback& | 63 const fileapi::FileSystemOperationInterface::OpenFileCallback& |
| 65 callback) OVERRIDE; | 64 callback) OVERRIDE; |
| 66 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. | 65 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. |
| 67 | 66 |
| 67 protected: |
| 68 virtual ~GDataFileSystemProxy(); |
| 69 |
| 68 private: | 70 private: |
| 69 // Checks if a given |url| belongs to this file system. If it does, | 71 // Checks if a given |url| belongs to this file system. If it does, |
| 70 // the call will return true and fill in |file_path| with a file path of | 72 // the call will return true and fill in |file_path| with a file path of |
| 71 // a corresponding element within this file system. | 73 // a corresponding element within this file system. |
| 72 static bool ValidateUrl(const GURL& url, FilePath* file_path); | 74 static bool ValidateUrl(const GURL& url, FilePath* file_path); |
| 73 | 75 |
| 74 // Helper callback for relaying reply for metadata retrieval request to the | 76 // Helper callback for relaying reply for metadata retrieval request to the |
| 75 // calling thread. | 77 // calling thread. |
| 76 void OnGetMetadata( | 78 void OnGetMetadata( |
| 77 const FilePath& file_path, | 79 const FilePath& file_path, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // GDataFileSystemProxy is owned by Profile, which outlives | 135 // GDataFileSystemProxy is owned by Profile, which outlives |
| 134 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by | 136 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by |
| 135 // the time Profile is removed, the file manager is already gone). Hence | 137 // the time Profile is removed, the file manager is already gone). Hence |
| 136 // it's safe to use this as a raw pointer. | 138 // it's safe to use this as a raw pointer. |
| 137 GDataFileSystemInterface* file_system_; | 139 GDataFileSystemInterface* file_system_; |
| 138 }; | 140 }; |
| 139 | 141 |
| 140 } // namespace chromeos | 142 } // namespace chromeos |
| 141 | 143 |
| 142 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 144 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
| OLD | NEW |