blob: ae716d97cd3f7f129ec3bd7667a46edfe34d4096 [file] [log] [blame]
[email protected]553ee5ae2014-04-22 00:19:191// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_
6#define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_
7
dchengb21a1b12016-04-21 19:23:138#include <memory>
skym9dbfbcf2015-10-09 18:44:339#include <string>
10
Max Boguefef332d2016-07-28 22:09:0911#include "components/sync/base/model_type.h"
Marc Treiba14e1eb2019-10-21 12:39:0912#include "components/sync/base/weak_handle.h"
maxbogue455a57e32016-08-14 00:08:3213#include "components/sync/driver/data_type_controller.h"
[email protected]553ee5ae2014-04-22 00:19:1914
zea9276f212015-08-29 01:35:0315namespace invalidation {
16class InvalidationService;
17} // namespace invalidation
18
zea5758a242015-08-18 05:06:2019namespace syncer {
[email protected]553ee5ae2014-04-22 00:19:1920
maxbogue7e006db2016-10-03 19:48:2821class DataTypeDebugInfoListener;
zea9276f212015-08-29 01:35:0322class DataTypeEncryptionHandler;
zea9276f212015-08-29 01:35:0323class DataTypeManager;
24class DataTypeManagerObserver;
maxbogue6dcda762016-12-05 20:45:5625class SyncEngine;
Rushan Suleymanovd5c5ef52020-07-30 13:07:2426class SyncInvalidationsService;
zea9276f212015-08-29 01:35:0327
[email protected]553ee5ae2014-04-22 00:19:1928// This factory provides sync driver code with the model type specific sync/api
29// service (like SyncableService) implementations.
30class SyncApiComponentFactory {
31 public:
Marc Treib8c8f4b32021-05-27 17:53:4732 virtual ~SyncApiComponentFactory() = default;
[email protected]0ae5be32014-05-20 06:14:5433
Marc Treibf699c4d2018-05-11 11:42:0534 virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
maxbogue7e006db2016-10-03 19:48:2835 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
36 const DataTypeController::TypeMap* controllers,
37 const DataTypeEncryptionHandler* encryption_handler,
maxbogue27ff55902016-12-08 01:38:1438 ModelTypeConfigurer* configurer,
maxbogue7e006db2016-10-03 19:48:2839 DataTypeManagerObserver* observer) = 0;
zea9276f212015-08-29 01:35:0340
Rushan Suleymanovd5c5ef52020-07-30 13:07:2441 // Creating this in the factory helps us mock it out in testing. |invalidator|
42 // and |sync_invalidation_service| are different invalidations. SyncEngine
43 // handles incoming invalidations from both of them (if provided).
44 // |sync_invalidation_service| is a new sync-specific invalidations service
45 // and it may be nullptr if it is disabled or not supported. In future, there
46 // will leave only one invalidation service.
Marc Treibf699c4d2018-05-11 11:42:0547 virtual std::unique_ptr<SyncEngine> CreateSyncEngine(
zea9276f212015-08-29 01:35:0348 const std::string& name,
49 invalidation::InvalidationService* invalidator,
Mikel Astizdcdd123f2021-01-29 18:43:5350 syncer::SyncInvalidationsService* sync_invalidation_service) = 0;
Victor Hugo Vianna Silva29c30192020-10-15 18:54:0451
Mikel Astizc959c65d2021-05-03 18:49:1552 // Clears all local transport data. Upon calling this, the deletion is
53 // guaranteed to finish before a new engine returned by |CreateSyncEngine()|
54 // can do any proper work.
55 virtual void ClearAllTransportData() = 0;
[email protected]553ee5ae2014-04-22 00:19:1956};
57
maxbogue7e006db2016-10-03 19:48:2858} // namespace syncer
[email protected]553ee5ae2014-04-22 00:19:1959
60#endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_