| 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; |
| 17 class GDataDirectoryProto; |
| 16 class GDataFileSystemInterface; | 18 class GDataFileSystemInterface; |
| 17 | 19 |
| 18 // The interface class for remote file system proxy. | 20 // The interface class for remote file system proxy. |
| 19 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { | 21 class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { |
| 20 public: | 22 public: |
| 21 // |profile| is used to create GDataFileSystem, which is a per-profile | 23 // |profile| is used to create GDataFileSystem, which is a per-profile |
| 22 // instance. | 24 // instance. |
| 23 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system); | 25 explicit GDataFileSystemProxy(GDataFileSystemInterface* file_system); |
| 24 virtual ~GDataFileSystemProxy(); | 26 virtual ~GDataFileSystemProxy(); |
| 25 | 27 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 callback) OVERRIDE; | 53 callback) OVERRIDE; |
| 52 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. | 54 // TODO(zelidrag): More methods to follow as we implement other parts of FSO. |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // Checks if a given |url| belongs to this file system. If it does, | 57 // Checks if a given |url| belongs to this file system. If it does, |
| 56 // the call will return true and fill in |file_path| with a file path of | 58 // the call will return true and fill in |file_path| with a file path of |
| 57 // a corresponding element within this file system. | 59 // a corresponding element within this file system. |
| 58 static bool ValidateUrl(const GURL& url, FilePath* file_path); | 60 static bool ValidateUrl(const GURL& url, FilePath* file_path); |
| 59 | 61 |
| 60 // Helper callback for relaying reply for metadata retrieval request to the | 62 // Helper callback for relaying reply for metadata retrieval request to the |
| 61 // calling thread. The callback is invoked while |file| is kept under lock | 63 // calling thread. |
| 62 // so it is safe to retrieve data from it, but this pointer is not safe to | |
| 63 // be used outside of this method. | |
| 64 void OnGetMetadata( | 64 void OnGetMetadata( |
| 65 const FilePath& file_path, | 65 const FilePath& file_path, |
| 66 const fileapi::FileSystemOperationInterface::GetMetadataCallback& | 66 const fileapi::FileSystemOperationInterface::GetMetadataCallback& |
| 67 callback, | 67 callback, |
| 68 base::PlatformFileError error, | 68 base::PlatformFileError error, |
| 69 const FilePath& directory_path, | 69 scoped_ptr<gdata::GDataEntryProto> entry_proto); |
| 70 GDataEntry* entry); | |
| 71 | 70 |
| 72 // Helper callback for relaying reply for ReadDirectory() to the calling | 71 // Helper callback for relaying reply for ReadDirectory() to the calling |
| 73 // thread. The callback is invoked while |file| is kept under lock | 72 // thread. |
| 74 // so it is safe to retrieve data from it, but this pointer is not safe to | |
| 75 // be used outside of this method. | |
| 76 void OnReadDirectory( | 73 void OnReadDirectory( |
| 77 bool hide_hosted_documents, | 74 bool hide_hosted_documents, |
| 78 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback& | 75 const fileapi::FileSystemOperationInterface::ReadDirectoryCallback& |
| 79 callback, | 76 callback, |
| 80 base::PlatformFileError error, | 77 base::PlatformFileError error, |
| 81 const FilePath& directory_path, | 78 scoped_ptr<GDataDirectoryProto> directory_proto); |
| 82 GDataEntry* entry); | |
| 83 | 79 |
| 84 // GDataFileSystemProxy is owned by Profile, which outlives | 80 // GDataFileSystemProxy is owned by Profile, which outlives |
| 85 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by | 81 // GDataFileSystemProxy, which is owned by CrosMountPointProvider (i.e. by |
| 86 // the time Profile is removed, the file manager is already gone). Hence | 82 // the time Profile is removed, the file manager is already gone). Hence |
| 87 // it's safe to use this as a raw pointer. | 83 // it's safe to use this as a raw pointer. |
| 88 GDataFileSystemInterface* file_system_; | 84 GDataFileSystemInterface* file_system_; |
| 89 }; | 85 }; |
| 90 | 86 |
| 91 } // namespace chromeos | 87 } // namespace chromeos |
| 92 | 88 |
| 93 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_FILE_SYSTEM_PROXY_H_ |
| OLD | NEW |