| 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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 class FileSystemObserver; | 36 class FileSystemObserver; |
| 37 class JobScheduler; | 37 class JobScheduler; |
| 38 | 38 |
| 39 namespace internal { | 39 namespace internal { |
| 40 class ChangeListLoader; | 40 class ChangeListLoader; |
| 41 class ResourceMetadata; | 41 class ResourceMetadata; |
| 42 class SyncClient; | 42 class SyncClient; |
| 43 } // namespace internal | 43 } // namespace internal |
| 44 | 44 |
| 45 namespace file_system { | 45 namespace file_system { |
| 46 class CloseFileOperation; | |
| 47 class CopyOperation; | 46 class CopyOperation; |
| 48 class CreateDirectoryOperation; | 47 class CreateDirectoryOperation; |
| 49 class CreateFileOperation; | 48 class CreateFileOperation; |
| 50 class DownloadOperation; | 49 class DownloadOperation; |
| 51 class MoveOperation; | 50 class MoveOperation; |
| 52 class OpenFileOperation; | 51 class OpenFileOperation; |
| 53 class OperationObserver; | 52 class OperationObserver; |
| 54 class RemoveOperation; | 53 class RemoveOperation; |
| 55 class SearchOperation; | 54 class SearchOperation; |
| 56 class TouchOperation; | 55 class TouchOperation; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const base::FilePath& remote_src_file_path, | 87 const base::FilePath& remote_src_file_path, |
| 89 const base::FilePath& local_dest_file_path, | 88 const base::FilePath& local_dest_file_path, |
| 90 const FileOperationCallback& callback) OVERRIDE; | 89 const FileOperationCallback& callback) OVERRIDE; |
| 91 virtual void TransferFileFromLocalToRemote( | 90 virtual void TransferFileFromLocalToRemote( |
| 92 const base::FilePath& local_src_file_path, | 91 const base::FilePath& local_src_file_path, |
| 93 const base::FilePath& remote_dest_file_path, | 92 const base::FilePath& remote_dest_file_path, |
| 94 const FileOperationCallback& callback) OVERRIDE; | 93 const FileOperationCallback& callback) OVERRIDE; |
| 95 virtual void OpenFile(const base::FilePath& file_path, | 94 virtual void OpenFile(const base::FilePath& file_path, |
| 96 OpenMode open_mode, | 95 OpenMode open_mode, |
| 97 const OpenFileCallback& callback) OVERRIDE; | 96 const OpenFileCallback& callback) OVERRIDE; |
| 98 virtual void CloseFile(const base::FilePath& file_path, | |
| 99 const FileOperationCallback& callback) OVERRIDE; | |
| 100 virtual void Copy(const base::FilePath& src_file_path, | 97 virtual void Copy(const base::FilePath& src_file_path, |
| 101 const base::FilePath& dest_file_path, | 98 const base::FilePath& dest_file_path, |
| 102 const FileOperationCallback& callback) OVERRIDE; | 99 const FileOperationCallback& callback) OVERRIDE; |
| 103 virtual void Move(const base::FilePath& src_file_path, | 100 virtual void Move(const base::FilePath& src_file_path, |
| 104 const base::FilePath& dest_file_path, | 101 const base::FilePath& dest_file_path, |
| 105 const FileOperationCallback& callback) OVERRIDE; | 102 const FileOperationCallback& callback) OVERRIDE; |
| 106 virtual void Remove(const base::FilePath& file_path, | 103 virtual void Remove(const base::FilePath& file_path, |
| 107 bool is_recursive, | 104 bool is_recursive, |
| 108 const FileOperationCallback& callback) OVERRIDE; | 105 const FileOperationCallback& callback) OVERRIDE; |
| 109 virtual void CreateDirectory(const base::FilePath& directory_path, | 106 virtual void CreateDirectory(const base::FilePath& directory_path, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 136 const GetResourceEntryCallback& callback) OVERRIDE; | 133 const GetResourceEntryCallback& callback) OVERRIDE; |
| 137 virtual void ReadDirectoryByPath( | 134 virtual void ReadDirectoryByPath( |
| 138 const base::FilePath& directory_path, | 135 const base::FilePath& directory_path, |
| 139 const ReadDirectoryCallback& callback) OVERRIDE; | 136 const ReadDirectoryCallback& callback) OVERRIDE; |
| 140 virtual void GetAvailableSpace( | 137 virtual void GetAvailableSpace( |
| 141 const GetAvailableSpaceCallback& callback) OVERRIDE; | 138 const GetAvailableSpaceCallback& callback) OVERRIDE; |
| 142 virtual void GetMetadata( | 139 virtual void GetMetadata( |
| 143 const GetFilesystemMetadataCallback& callback) OVERRIDE; | 140 const GetFilesystemMetadataCallback& callback) OVERRIDE; |
| 144 virtual void MarkCacheFileAsMounted( | 141 virtual void MarkCacheFileAsMounted( |
| 145 const base::FilePath& drive_file_path, | 142 const base::FilePath& drive_file_path, |
| 146 const OpenFileCallback& callback) OVERRIDE; | 143 const MarkMountedCallback& callback) OVERRIDE; |
| 147 virtual void MarkCacheFileAsUnmounted( | 144 virtual void MarkCacheFileAsUnmounted( |
| 148 const base::FilePath& cache_file_path, | 145 const base::FilePath& cache_file_path, |
| 149 const FileOperationCallback& callback) OVERRIDE; | 146 const FileOperationCallback& callback) OVERRIDE; |
| 150 virtual void GetCacheEntryByResourceId( | 147 virtual void GetCacheEntryByResourceId( |
| 151 const std::string& resource_id, | 148 const std::string& resource_id, |
| 152 const std::string& md5, | 149 const std::string& md5, |
| 153 const GetCacheEntryCallback& callback) OVERRIDE; | 150 const GetCacheEntryCallback& callback) OVERRIDE; |
| 154 virtual void Reload() OVERRIDE; | 151 virtual void Reload() OVERRIDE; |
| 155 | 152 |
| 156 // file_system::OperationObserver overrides. | 153 // file_system::OperationObserver overrides. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 const base::FilePath& local_cache_path); | 281 const base::FilePath& local_cache_path); |
| 285 void CheckLocalModificationAndRunAfterGetFileInfo( | 282 void CheckLocalModificationAndRunAfterGetFileInfo( |
| 286 scoped_ptr<ResourceEntry> entry, | 283 scoped_ptr<ResourceEntry> entry, |
| 287 const GetResourceEntryCallback& callback, | 284 const GetResourceEntryCallback& callback, |
| 288 base::PlatformFileInfo* file_info, | 285 base::PlatformFileInfo* file_info, |
| 289 bool get_file_info_result); | 286 bool get_file_info_result); |
| 290 | 287 |
| 291 // Part of MarkCacheFileAsMounted. Called after GetResourceEntryByPath is | 288 // Part of MarkCacheFileAsMounted. Called after GetResourceEntryByPath is |
| 292 // completed. |callback| must not be null. | 289 // completed. |callback| must not be null. |
| 293 void MarkCacheFileAsMountedAfterGetResourceEntry( | 290 void MarkCacheFileAsMountedAfterGetResourceEntry( |
| 294 const OpenFileCallback& callback, | 291 const MarkMountedCallback& callback, |
| 295 FileError error, | 292 FileError error, |
| 296 scoped_ptr<ResourceEntry> entry); | 293 scoped_ptr<ResourceEntry> entry); |
| 297 | 294 |
| 298 // Used to get Drive related preferences. | 295 // Used to get Drive related preferences. |
| 299 PrefService* pref_service_; | 296 PrefService* pref_service_; |
| 300 | 297 |
| 301 // Sub components owned by DriveIntegrationService. | 298 // Sub components owned by DriveIntegrationService. |
| 302 internal::FileCache* cache_; | 299 internal::FileCache* cache_; |
| 303 DriveServiceInterface* drive_service_; | 300 DriveServiceInterface* drive_service_; |
| 304 JobScheduler* scheduler_; | 301 JobScheduler* scheduler_; |
| 305 internal::ResourceMetadata* resource_metadata_; | 302 internal::ResourceMetadata* resource_metadata_; |
| 306 | 303 |
| 307 // Time of the last update check. | 304 // Time of the last update check. |
| 308 base::Time last_update_check_time_; | 305 base::Time last_update_check_time_; |
| 309 | 306 |
| 310 // Error of the last update check. | 307 // Error of the last update check. |
| 311 FileError last_update_check_error_; | 308 FileError last_update_check_error_; |
| 312 | 309 |
| 313 // True if hosted documents should be hidden. | 310 // True if hosted documents should be hidden. |
| 314 bool hide_hosted_docs_; | 311 bool hide_hosted_docs_; |
| 315 | 312 |
| 316 // Map from opened file paths to the number how many the file is opened. | |
| 317 // The value should be incremented by OpenFile, and decremented by CloseFile. | |
| 318 std::map<base::FilePath, int> open_files_; | |
| 319 | |
| 320 scoped_ptr<PrefChangeRegistrar> pref_registrar_; | 313 scoped_ptr<PrefChangeRegistrar> pref_registrar_; |
| 321 | 314 |
| 322 scoped_ptr<internal::SyncClient> sync_client_; | 315 scoped_ptr<internal::SyncClient> sync_client_; |
| 323 | 316 |
| 324 // The loader is used to load the change lists. | 317 // The loader is used to load the change lists. |
| 325 scoped_ptr<internal::ChangeListLoader> change_list_loader_; | 318 scoped_ptr<internal::ChangeListLoader> change_list_loader_; |
| 326 | 319 |
| 327 ObserverList<FileSystemObserver> observers_; | 320 ObserverList<FileSystemObserver> observers_; |
| 328 | 321 |
| 329 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 322 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 330 | 323 |
| 331 base::FilePath temporary_file_directory_; | 324 base::FilePath temporary_file_directory_; |
| 332 | 325 |
| 333 // Implementation of each file system operation. | 326 // Implementation of each file system operation. |
| 334 scoped_ptr<file_system::CloseFileOperation> close_file_operation_; | |
| 335 scoped_ptr<file_system::CopyOperation> copy_operation_; | 327 scoped_ptr<file_system::CopyOperation> copy_operation_; |
| 336 scoped_ptr<file_system::CreateDirectoryOperation> create_directory_operation_; | 328 scoped_ptr<file_system::CreateDirectoryOperation> create_directory_operation_; |
| 337 scoped_ptr<file_system::CreateFileOperation> create_file_operation_; | 329 scoped_ptr<file_system::CreateFileOperation> create_file_operation_; |
| 338 scoped_ptr<file_system::MoveOperation> move_operation_; | 330 scoped_ptr<file_system::MoveOperation> move_operation_; |
| 339 scoped_ptr<file_system::OpenFileOperation> open_file_operation_; | 331 scoped_ptr<file_system::OpenFileOperation> open_file_operation_; |
| 340 scoped_ptr<file_system::RemoveOperation> remove_operation_; | 332 scoped_ptr<file_system::RemoveOperation> remove_operation_; |
| 341 scoped_ptr<file_system::TouchOperation> touch_operation_; | 333 scoped_ptr<file_system::TouchOperation> touch_operation_; |
| 342 scoped_ptr<file_system::TruncateOperation> truncate_operation_; | 334 scoped_ptr<file_system::TruncateOperation> truncate_operation_; |
| 343 scoped_ptr<file_system::DownloadOperation> download_operation_; | 335 scoped_ptr<file_system::DownloadOperation> download_operation_; |
| 344 scoped_ptr<file_system::UpdateOperation> update_operation_; | 336 scoped_ptr<file_system::UpdateOperation> update_operation_; |
| 345 scoped_ptr<file_system::SearchOperation> search_operation_; | 337 scoped_ptr<file_system::SearchOperation> search_operation_; |
| 346 | 338 |
| 347 // Note: This should remain the last member so it'll be destroyed and | 339 // Note: This should remain the last member so it'll be destroyed and |
| 348 // invalidate the weak pointers before any other members are destroyed. | 340 // invalidate the weak pointers before any other members are destroyed. |
| 349 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; | 341 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; |
| 350 | 342 |
| 351 DISALLOW_COPY_AND_ASSIGN(FileSystem); | 343 DISALLOW_COPY_AND_ASSIGN(FileSystem); |
| 352 }; | 344 }; |
| 353 | 345 |
| 354 } // namespace drive | 346 } // namespace drive |
| 355 | 347 |
| 356 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 348 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| OLD | NEW |