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_DRIVE_BACKEND_SYNC_ENGINE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 private: | 78 private: |
79 DISALLOW_COPY_AND_ASSIGN(DriveServiceFactory); | 79 DISALLOW_COPY_AND_ASSIGN(DriveServiceFactory); |
80 }; | 80 }; |
81 | 81 |
82 static scoped_ptr<SyncEngine> CreateForBrowserContext( | 82 static scoped_ptr<SyncEngine> CreateForBrowserContext( |
83 content::BrowserContext* context, | 83 content::BrowserContext* context, |
84 TaskLogger* task_logger); | 84 TaskLogger* task_logger); |
85 static void AppendDependsOnFactories( | 85 static void AppendDependsOnFactories( |
86 std::set<BrowserContextKeyedServiceFactory*>* factories); | 86 std::set<BrowserContextKeyedServiceFactory*>* factories); |
87 | 87 |
88 virtual ~SyncEngine(); | 88 ~SyncEngine() override; |
89 void Reset(); | 89 void Reset(); |
90 | 90 |
91 // Can be called more than once. | 91 // Can be called more than once. |
92 void Initialize(); | 92 void Initialize(); |
93 | 93 |
94 void InitializeForTesting( | 94 void InitializeForTesting( |
95 scoped_ptr<drive::DriveServiceInterface> drive_service, | 95 scoped_ptr<drive::DriveServiceInterface> drive_service, |
96 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, | 96 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, |
97 scoped_ptr<SyncWorkerInterface> sync_worker); | 97 scoped_ptr<SyncWorkerInterface> sync_worker); |
98 void InitializeInternal( | 98 void InitializeInternal( |
99 scoped_ptr<drive::DriveServiceInterface> drive_service, | 99 scoped_ptr<drive::DriveServiceInterface> drive_service, |
100 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, | 100 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, |
101 scoped_ptr<SyncWorkerInterface> sync_worker); | 101 scoped_ptr<SyncWorkerInterface> sync_worker); |
102 | 102 |
103 // RemoteFileSyncService overrides. | 103 // RemoteFileSyncService overrides. |
104 virtual void AddServiceObserver(SyncServiceObserver* observer) override; | 104 void AddServiceObserver(SyncServiceObserver* observer) override; |
105 virtual void AddFileStatusObserver(FileStatusObserver* observer) override; | 105 void AddFileStatusObserver(FileStatusObserver* observer) override; |
106 virtual void RegisterOrigin( | 106 void RegisterOrigin(const GURL& origin, |
107 const GURL& origin, | 107 const SyncStatusCallback& callback) override; |
108 const SyncStatusCallback& callback) override; | 108 void EnableOrigin(const GURL& origin, |
109 virtual void EnableOrigin( | 109 const SyncStatusCallback& callback) override; |
110 const GURL& origin, | 110 void DisableOrigin(const GURL& origin, |
111 const SyncStatusCallback& callback) override; | 111 const SyncStatusCallback& callback) override; |
112 virtual void DisableOrigin( | 112 void UninstallOrigin(const GURL& origin, |
113 const GURL& origin, | 113 UninstallFlag flag, |
114 const SyncStatusCallback& callback) override; | 114 const SyncStatusCallback& callback) override; |
115 virtual void UninstallOrigin( | 115 void ProcessRemoteChange(const SyncFileCallback& callback) override; |
116 const GURL& origin, | 116 void SetRemoteChangeProcessor(RemoteChangeProcessor* processor) override; |
117 UninstallFlag flag, | 117 LocalChangeProcessor* GetLocalChangeProcessor() override; |
118 const SyncStatusCallback& callback) override; | 118 RemoteServiceState GetCurrentState() const override; |
119 virtual void ProcessRemoteChange(const SyncFileCallback& callback) override; | 119 void GetOriginStatusMap(const StatusMapCallback& callback) override; |
120 virtual void SetRemoteChangeProcessor( | 120 void DumpFiles(const GURL& origin, const ListCallback& callback) override; |
121 RemoteChangeProcessor* processor) override; | 121 void DumpDatabase(const ListCallback& callback) override; |
122 virtual LocalChangeProcessor* GetLocalChangeProcessor() override; | 122 void SetSyncEnabled(bool enabled) override; |
123 virtual RemoteServiceState GetCurrentState() const override; | 123 void PromoteDemotedChanges(const base::Closure& callback) override; |
124 virtual void GetOriginStatusMap(const StatusMapCallback& callback) override; | |
125 virtual void DumpFiles(const GURL& origin, | |
126 const ListCallback& callback) override; | |
127 virtual void DumpDatabase(const ListCallback& callback) override; | |
128 virtual void SetSyncEnabled(bool enabled) override; | |
129 virtual void PromoteDemotedChanges(const base::Closure& callback) override; | |
130 | 124 |
131 // LocalChangeProcessor overrides. | 125 // LocalChangeProcessor overrides. |
132 virtual void ApplyLocalChange(const FileChange& local_change, | 126 void ApplyLocalChange(const FileChange& local_change, |
133 const base::FilePath& local_path, | 127 const base::FilePath& local_path, |
134 const SyncFileMetadata& local_metadata, | 128 const SyncFileMetadata& local_metadata, |
135 const storage::FileSystemURL& url, | 129 const storage::FileSystemURL& url, |
136 const SyncStatusCallback& callback) override; | 130 const SyncStatusCallback& callback) override; |
137 | 131 |
138 // drive::DriveNotificationObserver overrides. | 132 // drive::DriveNotificationObserver overrides. |
139 virtual void OnNotificationReceived() override; | 133 void OnNotificationReceived() override; |
140 virtual void OnPushNotificationEnabled(bool enabled) override; | 134 void OnPushNotificationEnabled(bool enabled) override; |
141 | 135 |
142 // drive::DriveServiceObserver overrides. | 136 // drive::DriveServiceObserver overrides. |
143 virtual void OnReadyToSendRequests() override; | 137 void OnReadyToSendRequests() override; |
144 virtual void OnRefreshTokenInvalid() override; | 138 void OnRefreshTokenInvalid() override; |
145 | 139 |
146 // net::NetworkChangeNotifier::NetworkChangeObserver overrides. | 140 // net::NetworkChangeNotifier::NetworkChangeObserver overrides. |
147 virtual void OnNetworkChanged( | 141 void OnNetworkChanged( |
148 net::NetworkChangeNotifier::ConnectionType type) override; | 142 net::NetworkChangeNotifier::ConnectionType type) override; |
149 | 143 |
150 // SigninManagerBase::Observer overrides. | 144 // SigninManagerBase::Observer overrides. |
151 virtual void GoogleSigninFailed(const GoogleServiceAuthError& error) override; | 145 void GoogleSigninFailed(const GoogleServiceAuthError& error) override; |
152 virtual void GoogleSigninSucceeded(const std::string& account_id, | 146 void GoogleSigninSucceeded(const std::string& account_id, |
153 const std::string& username, | 147 const std::string& username, |
154 const std::string& password) override; | 148 const std::string& password) override; |
155 virtual void GoogleSignedOut(const std::string& account_id, | 149 void GoogleSignedOut(const std::string& account_id, |
156 const std::string& username) override; | 150 const std::string& username) override; |
157 | 151 |
158 private: | 152 private: |
159 class WorkerObserver; | 153 class WorkerObserver; |
160 | 154 |
161 friend class DriveBackendSyncTest; | 155 friend class DriveBackendSyncTest; |
162 friend class SyncEngineTest; | 156 friend class SyncEngineTest; |
163 friend class sync_file_system::SyncFileSystemTest; | 157 friend class sync_file_system::SyncFileSystemTest; |
164 | 158 |
165 SyncEngine(const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, | 159 SyncEngine(const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
166 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, | 160 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 CallbackTracker callback_tracker_; | 227 CallbackTracker callback_tracker_; |
234 | 228 |
235 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; | 229 base::WeakPtrFactory<SyncEngine> weak_ptr_factory_; |
236 DISALLOW_COPY_AND_ASSIGN(SyncEngine); | 230 DISALLOW_COPY_AND_ASSIGN(SyncEngine); |
237 }; | 231 }; |
238 | 232 |
239 } // namespace drive_backend | 233 } // namespace drive_backend |
240 } // namespace sync_file_system | 234 } // namespace sync_file_system |
241 | 235 |
242 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ | 236 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_ENGINE_H_ |
OLD | NEW |