OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 5 #ifndef COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 6 #define COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/task_runner.h" | 18 #include "base/task_runner.h" |
19 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
| 20 #include "components/sync/base/invalidation_interface.h" |
| 21 #include "components/sync/base/model_type.h" |
| 22 #include "components/sync/base/sync_export.h" |
| 23 #include "components/sync/base/weak_handle.h" |
| 24 #include "components/sync/core/change_record.h" |
| 25 #include "components/sync/core/configure_reason.h" |
| 26 #include "components/sync/core/connection_status.h" |
| 27 #include "components/sync/core/http_post_provider_factory.h" |
| 28 #include "components/sync/core/internal_components_factory.h" |
| 29 #include "components/sync/core/model_type_connector.h" |
| 30 #include "components/sync/core/shutdown_reason.h" |
| 31 #include "components/sync/core/sync_encryption_handler.h" |
| 32 #include "components/sync/engine/events/protocol_event.h" |
| 33 #include "components/sync/engine/model_safe_worker.h" |
| 34 #include "components/sync/engine/sync_status.h" |
| 35 #include "components/sync/protocol/sync_protocol_error.h" |
20 #include "google_apis/gaia/oauth2_token_service.h" | 36 #include "google_apis/gaia/oauth2_token_service.h" |
21 #include "sync/base/sync_export.h" | |
22 #include "sync/internal_api/public/base/invalidation_interface.h" | |
23 #include "sync/internal_api/public/base/model_type.h" | |
24 #include "sync/internal_api/public/change_record.h" | |
25 #include "sync/internal_api/public/configure_reason.h" | |
26 #include "sync/internal_api/public/connection_status.h" | |
27 #include "sync/internal_api/public/engine/model_safe_worker.h" | |
28 #include "sync/internal_api/public/engine/sync_status.h" | |
29 #include "sync/internal_api/public/events/protocol_event.h" | |
30 #include "sync/internal_api/public/http_post_provider_factory.h" | |
31 #include "sync/internal_api/public/internal_components_factory.h" | |
32 #include "sync/internal_api/public/model_type_connector.h" | |
33 #include "sync/internal_api/public/shutdown_reason.h" | |
34 #include "sync/internal_api/public/sync_encryption_handler.h" | |
35 #include "sync/internal_api/public/util/weak_handle.h" | |
36 #include "sync/protocol/sync_protocol_error.h" | |
37 | 37 |
38 class GURL; | 38 class GURL; |
39 | 39 |
40 namespace sync_pb { | 40 namespace sync_pb { |
41 class EncryptedData; | 41 class EncryptedData; |
42 } // namespace sync_pb | 42 } // namespace sync_pb |
43 | 43 |
44 namespace syncer { | 44 namespace syncer { |
45 | 45 |
46 class BaseTransaction; | 46 class BaseTransaction; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Used to propagate events to chrome://sync-internals. Optional. | 227 // Used to propagate events to chrome://sync-internals. Optional. |
228 WeakHandle<JsEventHandler> event_handler; | 228 WeakHandle<JsEventHandler> event_handler; |
229 | 229 |
230 // URL of the sync server. | 230 // URL of the sync server. |
231 GURL service_url; | 231 GURL service_url; |
232 | 232 |
233 // Used to communicate with the sync server. | 233 // Used to communicate with the sync server. |
234 std::unique_ptr<HttpPostProviderFactory> post_factory; | 234 std::unique_ptr<HttpPostProviderFactory> post_factory; |
235 | 235 |
236 std::vector<scoped_refptr<ModelSafeWorker> > workers; | 236 std::vector<scoped_refptr<ModelSafeWorker>> workers; |
237 | 237 |
238 // Must outlive SyncManager. | 238 // Must outlive SyncManager. |
239 ExtensionsActivity* extensions_activity; | 239 ExtensionsActivity* extensions_activity; |
240 | 240 |
241 // Must outlive SyncManager. | 241 // Must outlive SyncManager. |
242 ChangeDelegate* change_delegate; | 242 ChangeDelegate* change_delegate; |
243 | 243 |
244 // Credentials to be used when talking to the sync server. | 244 // Credentials to be used when talking to the sync server. |
245 SyncCredentials credentials; | 245 SyncCredentials credentials; |
246 | 246 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 // Purge from the directory those types with non-empty progress markers | 290 // Purge from the directory those types with non-empty progress markers |
291 // but without initial synced ended set. | 291 // but without initial synced ended set. |
292 // Returns false if an error occurred, true otherwise. | 292 // Returns false if an error occurred, true otherwise. |
293 virtual bool PurgePartiallySyncedTypes() = 0; | 293 virtual bool PurgePartiallySyncedTypes() = 0; |
294 | 294 |
295 // Update tokens that we're using in Sync. Email must stay the same. | 295 // Update tokens that we're using in Sync. Email must stay the same. |
296 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; | 296 virtual void UpdateCredentials(const SyncCredentials& credentials) = 0; |
297 | 297 |
298 // Put the syncer in normal mode ready to perform nudges and polls. | 298 // Put the syncer in normal mode ready to perform nudges and polls. |
299 virtual void StartSyncingNormally( | 299 virtual void StartSyncingNormally(const ModelSafeRoutingInfo& routing_info, |
300 const ModelSafeRoutingInfo& routing_info, | 300 base::Time last_poll_time) = 0; |
301 base::Time last_poll_time) = 0; | |
302 | 301 |
303 // Switches the mode of operation to CONFIGURATION_MODE and performs | 302 // Switches the mode of operation to CONFIGURATION_MODE and performs |
304 // any configuration tasks needed as determined by the params. Once complete, | 303 // any configuration tasks needed as determined by the params. Once complete, |
305 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is | 304 // syncer will remain in CONFIGURATION_MODE until StartSyncingNormally is |
306 // called. | 305 // called. |
307 // Data whose types are not in |new_routing_info| are purged from sync | 306 // Data whose types are not in |new_routing_info| are purged from sync |
308 // directory, unless they're part of |to_ignore|, in which case they're left | 307 // directory, unless they're part of |to_ignore|, in which case they're left |
309 // untouched. The purged data is backed up in delete journal for recovery in | 308 // untouched. The purged data is backed up in delete journal for recovery in |
310 // next session if its type is in |to_journal|. If in |to_unapply| | 309 // next session if its type is in |to_journal|. If in |to_unapply| |
311 // only the local data is removed; the server data is preserved. | 310 // only the local data is removed; the server data is preserved. |
312 // |ready_task| is invoked when the configuration completes. | 311 // |ready_task| is invoked when the configuration completes. |
313 // |retry_task| is invoked if the configuration job could not immediately | 312 // |retry_task| is invoked if the configuration job could not immediately |
314 // execute. |ready_task| will still be called when it eventually | 313 // execute. |ready_task| will still be called when it eventually |
315 // does finish. | 314 // does finish. |
316 virtual void ConfigureSyncer( | 315 virtual void ConfigureSyncer(ConfigureReason reason, |
317 ConfigureReason reason, | 316 ModelTypeSet to_download, |
318 ModelTypeSet to_download, | 317 ModelTypeSet to_purge, |
319 ModelTypeSet to_purge, | 318 ModelTypeSet to_journal, |
320 ModelTypeSet to_journal, | 319 ModelTypeSet to_unapply, |
321 ModelTypeSet to_unapply, | 320 const ModelSafeRoutingInfo& new_routing_info, |
322 const ModelSafeRoutingInfo& new_routing_info, | 321 const base::Closure& ready_task, |
323 const base::Closure& ready_task, | 322 const base::Closure& retry_task) = 0; |
324 const base::Closure& retry_task) = 0; | |
325 | 323 |
326 // Inform the syncer of a change in the invalidator's state. | 324 // Inform the syncer of a change in the invalidator's state. |
327 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; | 325 virtual void SetInvalidatorEnabled(bool invalidator_enabled) = 0; |
328 | 326 |
329 // Inform the syncer that its cached information about a type is obsolete. | 327 // Inform the syncer that its cached information about a type is obsolete. |
330 virtual void OnIncomingInvalidation( | 328 virtual void OnIncomingInvalidation( |
331 syncer::ModelType type, | 329 syncer::ModelType type, |
332 std::unique_ptr<syncer::InvalidationInterface> invalidation) = 0; | 330 std::unique_ptr<syncer::InvalidationInterface> invalidation) = 0; |
333 | 331 |
334 // Adds a listener to be notified of sync events. | 332 // Adds a listener to be notified of sync events. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; | 401 virtual void ClearServerData(const ClearServerDataCallback& callback) = 0; |
404 | 402 |
405 // Updates Sync's tracking of whether the cookie jar has a mismatch with the | 403 // Updates Sync's tracking of whether the cookie jar has a mismatch with the |
406 // chrome account. See ClientConfigParams proto message for more info. | 404 // chrome account. See ClientConfigParams proto message for more info. |
407 // Note: this does not trigger a sync cycle. It just updates the sync context. | 405 // Note: this does not trigger a sync cycle. It just updates the sync context. |
408 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; | 406 virtual void OnCookieJarChanged(bool account_mismatch, bool empty_jar) = 0; |
409 }; | 407 }; |
410 | 408 |
411 } // namespace syncer | 409 } // namespace syncer |
412 | 410 |
413 #endif // SYNC_INTERNAL_API_PUBLIC_SYNC_MANAGER_H_ | 411 #endif // COMPONENTS_SYNC_CORE_SYNC_MANAGER_H_ |
OLD | NEW |