| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "webkit/browser/fileapi/file_system_url.h" | 13 #include "storage/browser/fileapi/file_system_url.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace fileapi { | 17 namespace storage { |
| 18 class FileSystemContext; | 18 class FileSystemContext; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace sync_file_system { | 21 namespace sync_file_system { |
| 22 | 22 |
| 23 class LocalFileSyncStatus; | 23 class LocalFileSyncStatus; |
| 24 | 24 |
| 25 // A helper class to delete the root directory of a given Sync FileSystem. | 25 // A helper class to delete the root directory of a given Sync FileSystem. |
| 26 // This could happen when AppRoot (or SyncRoot) is deleted by remote operation, | 26 // This could happen when AppRoot (or SyncRoot) is deleted by remote operation, |
| 27 // and we want to delete all local files + all pending local changes in this | 27 // and we want to delete all local files + all pending local changes in this |
| 28 // case. | 28 // case. |
| 29 // | 29 // |
| 30 // Expected to be called on and will callback on IO thread. | 30 // Expected to be called on and will callback on IO thread. |
| 31 class RootDeleteHelper { | 31 class RootDeleteHelper { |
| 32 public: | 32 public: |
| 33 typedef base::Callback<void(base::File::Error)> FileStatusCallback; | 33 typedef base::Callback<void(base::File::Error)> FileStatusCallback; |
| 34 | 34 |
| 35 RootDeleteHelper(fileapi::FileSystemContext* file_system_context, | 35 RootDeleteHelper(storage::FileSystemContext* file_system_context, |
| 36 LocalFileSyncStatus* sync_status, | 36 LocalFileSyncStatus* sync_status, |
| 37 const fileapi::FileSystemURL& url, | 37 const storage::FileSystemURL& url, |
| 38 const FileStatusCallback& callback); | 38 const FileStatusCallback& callback); |
| 39 ~RootDeleteHelper(); | 39 ~RootDeleteHelper(); |
| 40 | 40 |
| 41 void Run(); | 41 void Run(); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void DidDeleteFileSystem(base::File::Error error); | 44 void DidDeleteFileSystem(base::File::Error error); |
| 45 void DidResetFileChangeTracker(); | 45 void DidResetFileChangeTracker(); |
| 46 void DidOpenFileSystem(const GURL& root, | 46 void DidOpenFileSystem(const GURL& root, |
| 47 const std::string& name, | 47 const std::string& name, |
| 48 base::File::Error error); | 48 base::File::Error error); |
| 49 | 49 |
| 50 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 50 scoped_refptr<storage::FileSystemContext> file_system_context_; |
| 51 const fileapi::FileSystemURL url_; | 51 const storage::FileSystemURL url_; |
| 52 FileStatusCallback callback_; | 52 FileStatusCallback callback_; |
| 53 | 53 |
| 54 // Not owned; owner of this instance owns it. | 54 // Not owned; owner of this instance owns it. |
| 55 LocalFileSyncStatus* sync_status_; | 55 LocalFileSyncStatus* sync_status_; |
| 56 | 56 |
| 57 base::WeakPtrFactory<RootDeleteHelper> weak_factory_; | 57 base::WeakPtrFactory<RootDeleteHelper> weak_factory_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(RootDeleteHelper); | 59 DISALLOW_COPY_AND_ASSIGN(RootDeleteHelper); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace sync_file_system | 62 } // namespace sync_file_system |
| 63 | 63 |
| 64 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ | 64 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_ROOT_DELETE_HELPER_H_ |
| OLD | NEW |