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