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 "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 9 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
10 #include "chrome/browser/sync_file_system/sync_status_code.h" | 10 #include "chrome/browser/sync_file_system/sync_status_code.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "storage/browser/fileapi/file_system_backend.h" | 13 #include "storage/browser/fileapi/file_system_backend.h" |
14 #include "storage/browser/fileapi/file_system_quota_util.h" | 14 #include "storage/browser/fileapi/file_system_quota_util.h" |
15 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" | 15 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" |
16 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" | 16 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" |
17 | 17 |
18 namespace sync_file_system { | 18 namespace sync_file_system { |
19 | 19 |
20 class LocalFileChangeTracker; | 20 class LocalFileChangeTracker; |
21 class LocalFileSyncContext; | 21 class LocalFileSyncContext; |
22 | 22 |
23 class SyncFileSystemBackend : public storage::FileSystemBackend { | 23 class SyncFileSystemBackend : public storage::FileSystemBackend { |
24 public: | 24 public: |
25 explicit SyncFileSystemBackend(Profile* profile); | 25 explicit SyncFileSystemBackend(Profile* profile); |
26 virtual ~SyncFileSystemBackend(); | 26 ~SyncFileSystemBackend() override; |
27 | 27 |
28 static SyncFileSystemBackend* CreateForTesting(); | 28 static SyncFileSystemBackend* CreateForTesting(); |
29 | 29 |
30 // FileSystemBackend overrides. | 30 // FileSystemBackend overrides. |
31 virtual bool CanHandleType(storage::FileSystemType type) const override; | 31 bool CanHandleType(storage::FileSystemType type) const override; |
32 virtual void Initialize(storage::FileSystemContext* context) override; | 32 void Initialize(storage::FileSystemContext* context) override; |
33 virtual void ResolveURL(const storage::FileSystemURL& url, | 33 void ResolveURL(const storage::FileSystemURL& url, |
34 storage::OpenFileSystemMode mode, | 34 storage::OpenFileSystemMode mode, |
35 const OpenFileSystemCallback& callback) override; | 35 const OpenFileSystemCallback& callback) override; |
36 virtual storage::AsyncFileUtil* GetAsyncFileUtil( | 36 storage::AsyncFileUtil* GetAsyncFileUtil( |
37 storage::FileSystemType type) override; | 37 storage::FileSystemType type) override; |
38 virtual storage::WatcherManager* GetWatcherManager( | 38 storage::WatcherManager* GetWatcherManager( |
39 storage::FileSystemType type) override; | 39 storage::FileSystemType type) override; |
40 virtual storage::CopyOrMoveFileValidatorFactory* | 40 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
41 GetCopyOrMoveFileValidatorFactory(storage::FileSystemType type, | 41 storage::FileSystemType type, |
42 base::File::Error* error_code) override; | 42 base::File::Error* error_code) override; |
43 virtual storage::FileSystemOperation* CreateFileSystemOperation( | 43 storage::FileSystemOperation* CreateFileSystemOperation( |
44 const storage::FileSystemURL& url, | 44 const storage::FileSystemURL& url, |
45 storage::FileSystemContext* context, | 45 storage::FileSystemContext* context, |
46 base::File::Error* error_code) const override; | 46 base::File::Error* error_code) const override; |
47 virtual bool SupportsStreaming( | 47 bool SupportsStreaming(const storage::FileSystemURL& url) const override; |
48 const storage::FileSystemURL& url) const override; | 48 bool HasInplaceCopyImplementation( |
49 virtual bool HasInplaceCopyImplementation( | |
50 storage::FileSystemType type) const override; | 49 storage::FileSystemType type) const override; |
51 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 50 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( |
52 const storage::FileSystemURL& url, | 51 const storage::FileSystemURL& url, |
53 int64 offset, | 52 int64 offset, |
54 int64 max_bytes_to_read, | 53 int64 max_bytes_to_read, |
55 const base::Time& expected_modification_time, | 54 const base::Time& expected_modification_time, |
56 storage::FileSystemContext* context) const override; | 55 storage::FileSystemContext* context) const override; |
57 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( | 56 scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( |
58 const storage::FileSystemURL& url, | 57 const storage::FileSystemURL& url, |
59 int64 offset, | 58 int64 offset, |
60 storage::FileSystemContext* context) const override; | 59 storage::FileSystemContext* context) const override; |
61 virtual storage::FileSystemQuotaUtil* GetQuotaUtil() override; | 60 storage::FileSystemQuotaUtil* GetQuotaUtil() override; |
62 virtual const storage::UpdateObserverList* GetUpdateObservers( | 61 const storage::UpdateObserverList* GetUpdateObservers( |
63 storage::FileSystemType type) const override; | 62 storage::FileSystemType type) const override; |
64 virtual const storage::ChangeObserverList* GetChangeObservers( | 63 const storage::ChangeObserverList* GetChangeObservers( |
65 storage::FileSystemType type) const override; | 64 storage::FileSystemType type) const override; |
66 virtual const storage::AccessObserverList* GetAccessObservers( | 65 const storage::AccessObserverList* GetAccessObservers( |
67 storage::FileSystemType type) const override; | 66 storage::FileSystemType type) const override; |
68 | 67 |
69 static SyncFileSystemBackend* GetBackend( | 68 static SyncFileSystemBackend* GetBackend( |
70 const storage::FileSystemContext* context); | 69 const storage::FileSystemContext* context); |
71 | 70 |
72 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } | 71 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } |
73 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); | 72 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); |
74 | 73 |
75 LocalFileSyncContext* sync_context() { return sync_context_.get(); } | 74 LocalFileSyncContext* sync_context() { return sync_context_.get(); } |
76 void set_sync_context(LocalFileSyncContext* sync_context); | 75 void set_sync_context(LocalFileSyncContext* sync_context); |
77 | 76 |
78 private: | 77 private: |
79 class ProfileHolder : public content::NotificationObserver { | 78 class ProfileHolder : public content::NotificationObserver { |
80 public: | 79 public: |
81 explicit ProfileHolder(Profile* profile); | 80 explicit ProfileHolder(Profile* profile); |
82 | 81 |
83 // NotificationObserver override. | 82 // NotificationObserver override. |
84 virtual void Observe(int type, | 83 void Observe(int type, |
85 const content::NotificationSource& source, | 84 const content::NotificationSource& source, |
86 const content::NotificationDetails& details) override; | 85 const content::NotificationDetails& details) override; |
87 | 86 |
88 Profile* GetProfile(); | 87 Profile* GetProfile(); |
89 | 88 |
90 private: | 89 private: |
91 content::NotificationRegistrar registrar_; | 90 content::NotificationRegistrar registrar_; |
92 Profile* profile_; | 91 Profile* profile_; |
93 }; | 92 }; |
94 | 93 |
95 // Not owned. | 94 // Not owned. |
96 storage::FileSystemContext* context_; | 95 storage::FileSystemContext* context_; |
(...skipping 20 matching lines...) Expand all Loading... |
117 storage::OpenFileSystemMode mode, | 116 storage::OpenFileSystemMode mode, |
118 const OpenFileSystemCallback& callback, | 117 const OpenFileSystemCallback& callback, |
119 SyncStatusCode status); | 118 SyncStatusCode status); |
120 | 119 |
121 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); | 120 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); |
122 }; | 121 }; |
123 | 122 |
124 } // namespace sync_file_system | 123 } // namespace sync_file_system |
125 | 124 |
126 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ | 125 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |