| 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_SYNC_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 43 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
| 44 storage::FileSystemType type, | 44 storage::FileSystemType type, |
| 45 base::File::Error* error_code) override; | 45 base::File::Error* error_code) override; |
| 46 storage::FileSystemOperation* CreateFileSystemOperation( | 46 storage::FileSystemOperation* CreateFileSystemOperation( |
| 47 const storage::FileSystemURL& url, | 47 const storage::FileSystemURL& url, |
| 48 storage::FileSystemContext* context, | 48 storage::FileSystemContext* context, |
| 49 base::File::Error* error_code) const override; | 49 base::File::Error* error_code) const override; |
| 50 bool SupportsStreaming(const storage::FileSystemURL& url) const override; | 50 bool SupportsStreaming(const storage::FileSystemURL& url) const override; |
| 51 bool HasInplaceCopyImplementation( | 51 bool HasInplaceCopyImplementation( |
| 52 storage::FileSystemType type) const override; | 52 storage::FileSystemType type) const override; |
| 53 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 53 std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader( |
| 54 const storage::FileSystemURL& url, | 54 const storage::FileSystemURL& url, |
| 55 int64_t offset, | 55 int64_t offset, |
| 56 int64_t max_bytes_to_read, | 56 int64_t max_bytes_to_read, |
| 57 const base::Time& expected_modification_time, | 57 const base::Time& expected_modification_time, |
| 58 storage::FileSystemContext* context) const override; | 58 storage::FileSystemContext* context) const override; |
| 59 scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( | 59 std::unique_ptr<storage::FileStreamWriter> CreateFileStreamWriter( |
| 60 const storage::FileSystemURL& url, | 60 const storage::FileSystemURL& url, |
| 61 int64_t offset, | 61 int64_t offset, |
| 62 storage::FileSystemContext* context) const override; | 62 storage::FileSystemContext* context) const override; |
| 63 storage::FileSystemQuotaUtil* GetQuotaUtil() override; | 63 storage::FileSystemQuotaUtil* GetQuotaUtil() override; |
| 64 const storage::UpdateObserverList* GetUpdateObservers( | 64 const storage::UpdateObserverList* GetUpdateObservers( |
| 65 storage::FileSystemType type) const override; | 65 storage::FileSystemType type) const override; |
| 66 const storage::ChangeObserverList* GetChangeObservers( | 66 const storage::ChangeObserverList* GetChangeObservers( |
| 67 storage::FileSystemType type) const override; | 67 storage::FileSystemType type) const override; |
| 68 const storage::AccessObserverList* GetAccessObservers( | 68 const storage::AccessObserverList* GetAccessObservers( |
| 69 storage::FileSystemType type) const override; | 69 storage::FileSystemType type) const override; |
| 70 | 70 |
| 71 static SyncFileSystemBackend* GetBackend( | 71 static SyncFileSystemBackend* GetBackend( |
| 72 const storage::FileSystemContext* context); | 72 const storage::FileSystemContext* context); |
| 73 | 73 |
| 74 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } | 74 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } |
| 75 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); | 75 void SetLocalFileChangeTracker( |
| 76 std::unique_ptr<LocalFileChangeTracker> tracker); |
| 76 | 77 |
| 77 LocalFileSyncContext* sync_context() { return sync_context_.get(); } | 78 LocalFileSyncContext* sync_context() { return sync_context_.get(); } |
| 78 void set_sync_context(LocalFileSyncContext* sync_context); | 79 void set_sync_context(LocalFileSyncContext* sync_context); |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 class ProfileHolder : public content::NotificationObserver { | 82 class ProfileHolder : public content::NotificationObserver { |
| 82 public: | 83 public: |
| 83 explicit ProfileHolder(Profile* profile); | 84 explicit ProfileHolder(Profile* profile); |
| 84 | 85 |
| 85 // NotificationObserver override. | 86 // NotificationObserver override. |
| 86 void Observe(int type, | 87 void Observe(int type, |
| 87 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
| 88 const content::NotificationDetails& details) override; | 89 const content::NotificationDetails& details) override; |
| 89 | 90 |
| 90 Profile* GetProfile(); | 91 Profile* GetProfile(); |
| 91 | 92 |
| 92 private: | 93 private: |
| 93 content::NotificationRegistrar registrar_; | 94 content::NotificationRegistrar registrar_; |
| 94 Profile* profile_; | 95 Profile* profile_; |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 // Not owned. | 98 // Not owned. |
| 98 storage::FileSystemContext* context_; | 99 storage::FileSystemContext* context_; |
| 99 | 100 |
| 100 scoped_ptr<LocalFileChangeTracker> change_tracker_; | 101 std::unique_ptr<LocalFileChangeTracker> change_tracker_; |
| 101 scoped_refptr<LocalFileSyncContext> sync_context_; | 102 scoped_refptr<LocalFileSyncContext> sync_context_; |
| 102 | 103 |
| 103 // Should be accessed on the UI thread. | 104 // Should be accessed on the UI thread. |
| 104 scoped_ptr<ProfileHolder> profile_holder_; | 105 std::unique_ptr<ProfileHolder> profile_holder_; |
| 105 | 106 |
| 106 // A flag to skip the initialization sequence of SyncFileSystemService for | 107 // A flag to skip the initialization sequence of SyncFileSystemService for |
| 107 // testing. | 108 // testing. |
| 108 bool skip_initialize_syncfs_service_for_testing_; | 109 bool skip_initialize_syncfs_service_for_testing_; |
| 109 | 110 |
| 110 storage::SandboxFileSystemBackendDelegate* GetDelegate() const; | 111 storage::SandboxFileSystemBackendDelegate* GetDelegate() const; |
| 111 | 112 |
| 112 void InitializeSyncFileSystemService( | 113 void InitializeSyncFileSystemService( |
| 113 const GURL& origin_url, | 114 const GURL& origin_url, |
| 114 const SyncStatusCallback& callback); | 115 const SyncStatusCallback& callback); |
| 115 void DidInitializeSyncFileSystemService( | 116 void DidInitializeSyncFileSystemService( |
| 116 storage::FileSystemContext* context, | 117 storage::FileSystemContext* context, |
| 117 const GURL& origin_url, | 118 const GURL& origin_url, |
| 118 storage::FileSystemType type, | 119 storage::FileSystemType type, |
| 119 storage::OpenFileSystemMode mode, | 120 storage::OpenFileSystemMode mode, |
| 120 const OpenFileSystemCallback& callback, | 121 const OpenFileSystemCallback& callback, |
| 121 SyncStatusCode status); | 122 SyncStatusCode status); |
| 122 | 123 |
| 123 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); | 124 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 } // namespace sync_file_system | 127 } // namespace sync_file_system |
| 127 | 128 |
| 128 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ | 129 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ |
| OLD | NEW |