| 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_DRIVE_FILE_SYSTEM_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/chromeos/drive/file_errors.h" | 8 #include "chrome/browser/chromeos/drive/file_errors.h" |
| 9 #include "webkit/fileapi/remote_file_system_proxy.h" | 9 #include "webkit/fileapi/remote_file_system_proxy.h" |
| 10 | 10 |
| 11 namespace fileapi { | 11 namespace fileapi { |
| 12 class FileSystemURL; | 12 class FileSystemURL; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace drive { | 15 namespace drive { |
| 16 | 16 |
| 17 class FileSystemInterface; | 17 class FileSystemInterface; |
| 18 class ResourceEntry; | 18 class ResourceEntry; |
| 19 | 19 |
| 20 typedef std::vector<ResourceEntry> ResourceEntryVector; | 20 typedef std::vector<ResourceEntry> ResourceEntryVector; |
| 21 | 21 |
| 22 // Implementation of File API's remote file system proxy for Drive file system. | 22 // Implementation of File API's remote file system proxy for Drive-backed |
| 23 // file system. |
| 23 class FileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { | 24 class FileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { |
| 24 public: | 25 public: |
| 25 using fileapi::RemoteFileSystemProxyInterface::OpenFileCallback; | 26 using fileapi::RemoteFileSystemProxyInterface::OpenFileCallback; |
| 26 | 27 |
| 27 // |file_system| is the FileSystem instance owned by DriveIntegrationService. | 28 // |file_system| is the FileSystem instance owned by DriveIntegrationService. |
| 28 explicit FileSystemProxy(FileSystemInterface* file_system); | 29 explicit FileSystemProxy(FileSystemInterface* file_system); |
| 29 | 30 |
| 30 // Detaches this instance from |file_system_|. | 31 // Detaches this instance from |file_system_|. |
| 31 // Method calls may result in no-op after calling this method. | 32 // Method calls may result in no-op after calling this method. |
| 32 // This method must be called on UI thread. | 33 // This method must be called on UI thread. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 protected: | 98 protected: |
| 98 virtual ~FileSystemProxy(); | 99 virtual ~FileSystemProxy(); |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 // Checks if a given |url| belongs to this file system. If it does, | 102 // Checks if a given |url| belongs to this file system. If it does, |
| 102 // the call will return true and fill in |file_path| with a file path of | 103 // the call will return true and fill in |file_path| with a file path of |
| 103 // a corresponding element within this file system. | 104 // a corresponding element within this file system. |
| 104 static bool ValidateUrl(const fileapi::FileSystemURL& url, | 105 static bool ValidateUrl(const fileapi::FileSystemURL& url, |
| 105 base::FilePath* file_path); | 106 base::FilePath* file_path); |
| 106 | 107 |
| 107 // Helper method to call methods of DriveFilesSystem. This method aborts | 108 // Helper method to call methods of FileSystem. This method aborts |
| 108 // method calls in case DetachFromFileSystem() has been called. | 109 // method calls in case DetachFromFileSystem() has been called. |
| 109 void CallFileSystemMethodOnUIThread(const base::Closure& method_call); | 110 void CallFileSystemMethodOnUIThread(const base::Closure& method_call); |
| 110 | 111 |
| 111 // Used to implement CallFileSystemMethodOnUIThread. | 112 // Used to implement CallFileSystemMethodOnUIThread. |
| 112 void CallFileSystemMethodOnUIThreadInternal( | 113 void CallFileSystemMethodOnUIThreadInternal( |
| 113 const base::Closure& method_call); | 114 const base::Closure& method_call); |
| 114 | 115 |
| 115 // Helper callback for relaying reply for status callbacks to the | 116 // Helper callback for relaying reply for status callbacks to the |
| 116 // calling thread. | 117 // calling thread. |
| 117 void OnStatusCallback( | 118 void OnStatusCallback( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 206 |
| 206 // Returns |file_system_| on UI thread. | 207 // Returns |file_system_| on UI thread. |
| 207 FileSystemInterface* GetFileSystemOnUIThread(); | 208 FileSystemInterface* GetFileSystemOnUIThread(); |
| 208 | 209 |
| 209 FileSystemInterface* file_system_; | 210 FileSystemInterface* file_system_; |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 } // namespace chromeos | 213 } // namespace chromeos |
| 213 | 214 |
| 214 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ | 215 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_PROXY_H_ |
| OLD | NEW |