| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 public internal::ChangeListLoaderObserver, | 63 public internal::ChangeListLoaderObserver, |
| 64 public file_system::OperationDelegate { | 64 public file_system::OperationDelegate { |
| 65 public: | 65 public: |
| 66 FileSystem(PrefService* pref_service, | 66 FileSystem(PrefService* pref_service, |
| 67 EventLogger* logger, | 67 EventLogger* logger, |
| 68 internal::FileCache* cache, | 68 internal::FileCache* cache, |
| 69 JobScheduler* scheduler, | 69 JobScheduler* scheduler, |
| 70 internal::ResourceMetadata* resource_metadata, | 70 internal::ResourceMetadata* resource_metadata, |
| 71 base::SequencedTaskRunner* blocking_task_runner, | 71 base::SequencedTaskRunner* blocking_task_runner, |
| 72 const base::FilePath& temporary_file_directory); | 72 const base::FilePath& temporary_file_directory); |
| 73 virtual ~FileSystem(); | 73 ~FileSystem() override; |
| 74 | 74 |
| 75 // FileSystemInterface overrides. | 75 // FileSystemInterface overrides. |
| 76 virtual void AddObserver(FileSystemObserver* observer) override; | 76 void AddObserver(FileSystemObserver* observer) override; |
| 77 virtual void RemoveObserver(FileSystemObserver* observer) override; | 77 void RemoveObserver(FileSystemObserver* observer) override; |
| 78 virtual void CheckForUpdates() override; | 78 void CheckForUpdates() override; |
| 79 virtual void Search(const std::string& search_query, | 79 void Search(const std::string& search_query, |
| 80 const GURL& next_link, | 80 const GURL& next_link, |
| 81 const SearchCallback& callback) override; | 81 const SearchCallback& callback) override; |
| 82 virtual void SearchMetadata(const std::string& query, | 82 void SearchMetadata(const std::string& query, |
| 83 int options, | 83 int options, |
| 84 int at_most_num_matches, | 84 int at_most_num_matches, |
| 85 const SearchMetadataCallback& callback) override; | 85 const SearchMetadataCallback& callback) override; |
| 86 virtual void TransferFileFromLocalToRemote( | 86 void TransferFileFromLocalToRemote( |
| 87 const base::FilePath& local_src_file_path, | 87 const base::FilePath& local_src_file_path, |
| 88 const base::FilePath& remote_dest_file_path, | 88 const base::FilePath& remote_dest_file_path, |
| 89 const FileOperationCallback& callback) override; | 89 const FileOperationCallback& callback) override; |
| 90 virtual void OpenFile(const base::FilePath& file_path, | 90 void OpenFile(const base::FilePath& file_path, |
| 91 OpenMode open_mode, | 91 OpenMode open_mode, |
| 92 const std::string& mime_type, | 92 const std::string& mime_type, |
| 93 const OpenFileCallback& callback) override; | 93 const OpenFileCallback& callback) override; |
| 94 virtual void Copy(const base::FilePath& src_file_path, | 94 void Copy(const base::FilePath& src_file_path, |
| 95 const base::FilePath& dest_file_path, | 95 const base::FilePath& dest_file_path, |
| 96 bool preserve_last_modified, | 96 bool preserve_last_modified, |
| 97 const FileOperationCallback& callback) override; |
| 98 void Move(const base::FilePath& src_file_path, |
| 99 const base::FilePath& dest_file_path, |
| 100 const FileOperationCallback& callback) override; |
| 101 void Remove(const base::FilePath& file_path, |
| 102 bool is_recursive, |
| 103 const FileOperationCallback& callback) override; |
| 104 void CreateDirectory(const base::FilePath& directory_path, |
| 105 bool is_exclusive, |
| 106 bool is_recursive, |
| 107 const FileOperationCallback& callback) override; |
| 108 void CreateFile(const base::FilePath& file_path, |
| 109 bool is_exclusive, |
| 110 const std::string& mime_type, |
| 111 const FileOperationCallback& callback) override; |
| 112 void TouchFile(const base::FilePath& file_path, |
| 113 const base::Time& last_access_time, |
| 114 const base::Time& last_modified_time, |
| 115 const FileOperationCallback& callback) override; |
| 116 void TruncateFile(const base::FilePath& file_path, |
| 117 int64 length, |
| 97 const FileOperationCallback& callback) override; | 118 const FileOperationCallback& callback) override; |
| 98 virtual void Move(const base::FilePath& src_file_path, | 119 void Pin(const base::FilePath& file_path, |
| 99 const base::FilePath& dest_file_path, | 120 const FileOperationCallback& callback) override; |
| 100 const FileOperationCallback& callback) override; | 121 void Unpin(const base::FilePath& file_path, |
| 101 virtual void Remove(const base::FilePath& file_path, | 122 const FileOperationCallback& callback) override; |
| 102 bool is_recursive, | 123 void GetFile(const base::FilePath& file_path, |
| 103 const FileOperationCallback& callback) override; | 124 const GetFileCallback& callback) override; |
| 104 virtual void CreateDirectory(const base::FilePath& directory_path, | 125 void GetFileForSaving(const base::FilePath& file_path, |
| 105 bool is_exclusive, | 126 const GetFileCallback& callback) override; |
| 106 bool is_recursive, | 127 base::Closure GetFileContent( |
| 107 const FileOperationCallback& callback) override; | |
| 108 virtual void CreateFile(const base::FilePath& file_path, | |
| 109 bool is_exclusive, | |
| 110 const std::string& mime_type, | |
| 111 const FileOperationCallback& callback) override; | |
| 112 virtual void TouchFile(const base::FilePath& file_path, | |
| 113 const base::Time& last_access_time, | |
| 114 const base::Time& last_modified_time, | |
| 115 const FileOperationCallback& callback) override; | |
| 116 virtual void TruncateFile(const base::FilePath& file_path, | |
| 117 int64 length, | |
| 118 const FileOperationCallback& callback) override; | |
| 119 virtual void Pin(const base::FilePath& file_path, | |
| 120 const FileOperationCallback& callback) override; | |
| 121 virtual void Unpin(const base::FilePath& file_path, | |
| 122 const FileOperationCallback& callback) override; | |
| 123 virtual void GetFile(const base::FilePath& file_path, | |
| 124 const GetFileCallback& callback) override; | |
| 125 virtual void GetFileForSaving(const base::FilePath& file_path, | |
| 126 const GetFileCallback& callback) override; | |
| 127 virtual base::Closure GetFileContent( | |
| 128 const base::FilePath& file_path, | 128 const base::FilePath& file_path, |
| 129 const GetFileContentInitializedCallback& initialized_callback, | 129 const GetFileContentInitializedCallback& initialized_callback, |
| 130 const google_apis::GetContentCallback& get_content_callback, | 130 const google_apis::GetContentCallback& get_content_callback, |
| 131 const FileOperationCallback& completion_callback) override; | 131 const FileOperationCallback& completion_callback) override; |
| 132 virtual void GetResourceEntry( | 132 void GetResourceEntry(const base::FilePath& file_path, |
| 133 const base::FilePath& file_path, | 133 const GetResourceEntryCallback& callback) override; |
| 134 const GetResourceEntryCallback& callback) override; | 134 void ReadDirectory(const base::FilePath& directory_path, |
| 135 virtual void ReadDirectory( | 135 const ReadDirectoryEntriesCallback& entries_callback, |
| 136 const base::FilePath& directory_path, | 136 const FileOperationCallback& completion_callback) override; |
| 137 const ReadDirectoryEntriesCallback& entries_callback, | 137 void GetAvailableSpace(const GetAvailableSpaceCallback& callback) override; |
| 138 const FileOperationCallback& completion_callback) override; | 138 void GetShareUrl(const base::FilePath& file_path, |
| 139 virtual void GetAvailableSpace( | 139 const GURL& embed_origin, |
| 140 const GetAvailableSpaceCallback& callback) override; | 140 const GetShareUrlCallback& callback) override; |
| 141 virtual void GetShareUrl( | 141 void GetMetadata(const GetFilesystemMetadataCallback& callback) override; |
| 142 const base::FilePath& file_path, | 142 void MarkCacheFileAsMounted(const base::FilePath& drive_file_path, |
| 143 const GURL& embed_origin, | 143 const MarkMountedCallback& callback) override; |
| 144 const GetShareUrlCallback& callback) override; | 144 void MarkCacheFileAsUnmounted(const base::FilePath& cache_file_path, |
| 145 virtual void GetMetadata( | 145 const FileOperationCallback& callback) override; |
| 146 const GetFilesystemMetadataCallback& callback) override; | 146 void AddPermission(const base::FilePath& drive_file_path, |
| 147 virtual void MarkCacheFileAsMounted( | 147 const std::string& email, |
| 148 const base::FilePath& drive_file_path, | 148 google_apis::drive::PermissionRole role, |
| 149 const MarkMountedCallback& callback) override; | 149 const FileOperationCallback& callback) override; |
| 150 virtual void MarkCacheFileAsUnmounted( | 150 void Reset(const FileOperationCallback& callback) override; |
| 151 const base::FilePath& cache_file_path, | 151 void GetPathFromResourceId(const std::string& resource_id, |
| 152 const FileOperationCallback& callback) override; | 152 const GetFilePathCallback& callback) override; |
| 153 virtual void AddPermission(const base::FilePath& drive_file_path, | |
| 154 const std::string& email, | |
| 155 google_apis::drive::PermissionRole role, | |
| 156 const FileOperationCallback& callback) override; | |
| 157 virtual void Reset(const FileOperationCallback& callback) override; | |
| 158 virtual void GetPathFromResourceId(const std::string& resource_id, | |
| 159 const GetFilePathCallback& callback) | |
| 160 override; | |
| 161 | 153 |
| 162 // file_system::OperationDelegate overrides. | 154 // file_system::OperationDelegate overrides. |
| 163 virtual void OnFileChangedByOperation( | 155 void OnFileChangedByOperation(const FileChange& changed_files) override; |
| 164 const FileChange& changed_files) override; | 156 void OnEntryUpdatedByOperation(const ClientContext& context, |
| 165 virtual void OnEntryUpdatedByOperation(const ClientContext& context, | 157 const std::string& local_id) override; |
| 166 const std::string& local_id) override; | 158 void OnDriveSyncError(file_system::DriveSyncErrorType type, |
| 167 virtual void OnDriveSyncError(file_system::DriveSyncErrorType type, | 159 const std::string& local_id) override; |
| 168 const std::string& local_id) override; | 160 bool WaitForSyncComplete(const std::string& local_id, |
| 169 virtual bool WaitForSyncComplete( | 161 const FileOperationCallback& callback) override; |
| 170 const std::string& local_id, | |
| 171 const FileOperationCallback& callback) override; | |
| 172 | 162 |
| 173 // ChangeListLoader::Observer overrides. | 163 // ChangeListLoader::Observer overrides. |
| 174 // Used to propagate events from ChangeListLoader. | 164 // Used to propagate events from ChangeListLoader. |
| 175 virtual void OnDirectoryReloaded( | 165 void OnDirectoryReloaded(const base::FilePath& directory_path) override; |
| 176 const base::FilePath& directory_path) override; | 166 void OnFileChanged(const FileChange& changed_files) override; |
| 177 virtual void OnFileChanged(const FileChange& changed_files) override; | 167 void OnLoadFromServerComplete() override; |
| 178 virtual void OnLoadFromServerComplete() override; | 168 void OnInitialLoadComplete() override; |
| 179 virtual void OnInitialLoadComplete() override; | |
| 180 | 169 |
| 181 // Used by tests. | 170 // Used by tests. |
| 182 internal::ChangeListLoader* change_list_loader_for_testing() { | 171 internal::ChangeListLoader* change_list_loader_for_testing() { |
| 183 return change_list_loader_.get(); | 172 return change_list_loader_.get(); |
| 184 } | 173 } |
| 185 internal::SyncClient* sync_client_for_testing() { return sync_client_.get(); } | 174 internal::SyncClient* sync_client_for_testing() { return sync_client_.get(); } |
| 186 | 175 |
| 187 private: | 176 private: |
| 188 struct CreateDirectoryParams; | 177 struct CreateDirectoryParams; |
| 189 | 178 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // Note: This should remain the last member so it'll be destroyed and | 284 // Note: This should remain the last member so it'll be destroyed and |
| 296 // invalidate the weak pointers before any other members are destroyed. | 285 // invalidate the weak pointers before any other members are destroyed. |
| 297 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; | 286 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; |
| 298 | 287 |
| 299 DISALLOW_COPY_AND_ASSIGN(FileSystem); | 288 DISALLOW_COPY_AND_ASSIGN(FileSystem); |
| 300 }; | 289 }; |
| 301 | 290 |
| 302 } // namespace drive | 291 } // namespace drive |
| 303 | 292 |
| 304 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 293 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
| OLD | NEW |