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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 const FileOperationCallback& callback) OVERRIDE; | 156 const FileOperationCallback& callback) OVERRIDE; |
157 virtual void GetCacheEntryByResourceId( | 157 virtual void GetCacheEntryByResourceId( |
158 const std::string& resource_id, | 158 const std::string& resource_id, |
159 const std::string& md5, | 159 const std::string& md5, |
160 const GetCacheEntryCallback& callback) OVERRIDE; | 160 const GetCacheEntryCallback& callback) OVERRIDE; |
161 virtual void Reload() OVERRIDE; | 161 virtual void Reload() OVERRIDE; |
162 | 162 |
163 // file_system::OperationObserver overrides. | 163 // file_system::OperationObserver overrides. |
164 virtual void OnDirectoryChangedByOperation( | 164 virtual void OnDirectoryChangedByOperation( |
165 const base::FilePath& directory_path) OVERRIDE; | 165 const base::FilePath& directory_path) OVERRIDE; |
| 166 virtual void OnCacheFileUploadNeededByOperation( |
| 167 const std::string& resource_id) OVERRIDE; |
166 | 168 |
167 // ChangeListLoader::Observer overrides. | 169 // ChangeListLoader::Observer overrides. |
168 // Used to propagate events from ChangeListLoader. | 170 // Used to propagate events from ChangeListLoader. |
169 virtual void OnDirectoryChanged( | 171 virtual void OnDirectoryChanged( |
170 const base::FilePath& directory_path) OVERRIDE; | 172 const base::FilePath& directory_path) OVERRIDE; |
171 virtual void OnLoadFromServerComplete() OVERRIDE; | 173 virtual void OnLoadFromServerComplete() OVERRIDE; |
172 virtual void OnInitialLoadComplete() OVERRIDE; | 174 virtual void OnInitialLoadComplete() OVERRIDE; |
173 | 175 |
174 // Used in tests to update the file system using the change list loader. | 176 // Used in tests to update the file system using the change list loader. |
175 internal::ChangeListLoader* change_list_loader() { | 177 internal::ChangeListLoader* change_list_loader() { |
176 return change_list_loader_.get(); | 178 return change_list_loader_.get(); |
177 } | 179 } |
178 | 180 |
| 181 // Used by tests. |
| 182 internal::SyncClient* sync_client_for_testing() { return sync_client_.get(); } |
| 183 |
179 private: | 184 private: |
180 friend class DriveFileSystemTest; | |
181 | |
182 // Used to implement Reload(). | 185 // Used to implement Reload(). |
183 void ReloadAfterReset(FileError error); | 186 void ReloadAfterReset(FileError error); |
184 | 187 |
185 // Sets up ChangeListLoader. | 188 // Sets up ChangeListLoader. |
186 void SetupChangeListLoader(); | 189 void SetupChangeListLoader(); |
187 | 190 |
188 // Called on preference change. | 191 // Called on preference change. |
189 void OnDisableDriveHostedFilesChanged(); | 192 void OnDisableDriveHostedFilesChanged(); |
190 | 193 |
191 // Part of CreateDirectory(). Called after ChangeListLoader::LoadIfNeeded() | 194 // Part of CreateDirectory(). Called after ChangeListLoader::LoadIfNeeded() |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Invoked during the process of CloseFile. What is done here is as follows: | 235 // Invoked during the process of CloseFile. What is done here is as follows: |
233 // 1) Gets resource_id and md5 of the entry at |file_path|. | 236 // 1) Gets resource_id and md5 of the entry at |file_path|. |
234 // 2) Commits the modification to the cache system. | 237 // 2) Commits the modification to the cache system. |
235 // 3) Removes the |file_path| from the remembered set of opened files. | 238 // 3) Removes the |file_path| from the remembered set of opened files. |
236 // 4) Invokes the user-supplied |callback|. | 239 // 4) Invokes the user-supplied |callback|. |
237 // |callback| must not be null. | 240 // |callback| must not be null. |
238 void CloseFileAfterGetResourceEntry(const base::FilePath& file_path, | 241 void CloseFileAfterGetResourceEntry(const base::FilePath& file_path, |
239 const FileOperationCallback& callback, | 242 const FileOperationCallback& callback, |
240 FileError error, | 243 FileError error, |
241 scoped_ptr<ResourceEntry> entry); | 244 scoped_ptr<ResourceEntry> entry); |
242 void CloseFileFinalize(const base::FilePath& file_path, | |
243 const FileOperationCallback& callback, | |
244 FileError result); | |
245 | 245 |
246 // Callback for handling about resource fetch. | 246 // Callback for handling about resource fetch. |
247 void OnGetAboutResource( | 247 void OnGetAboutResource( |
248 const GetAvailableSpaceCallback& callback, | 248 const GetAvailableSpaceCallback& callback, |
249 google_apis::GDataErrorCode status, | 249 google_apis::GDataErrorCode status, |
250 scoped_ptr<google_apis::AboutResource> about_resource); | 250 scoped_ptr<google_apis::AboutResource> about_resource); |
251 | 251 |
252 // Part of CheckForUpdates(). Called when | 252 // Part of CheckForUpdates(). Called when |
253 // ChangeListLoader::CheckForUpdates() is complete. | 253 // ChangeListLoader::CheckForUpdates() is complete. |
254 void OnUpdateChecked(FileError error); | 254 void OnUpdateChecked(FileError error); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // Note: This should remain the last member so it'll be destroyed and | 395 // Note: This should remain the last member so it'll be destroyed and |
396 // invalidate the weak pointers before any other members are destroyed. | 396 // invalidate the weak pointers before any other members are destroyed. |
397 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; | 397 base::WeakPtrFactory<FileSystem> weak_ptr_factory_; |
398 | 398 |
399 DISALLOW_COPY_AND_ASSIGN(FileSystem); | 399 DISALLOW_COPY_AND_ASSIGN(FileSystem); |
400 }; | 400 }; |
401 | 401 |
402 } // namespace drive | 402 } // namespace drive |
403 | 403 |
404 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ | 404 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_H_ |
OLD | NEW |