blob: 4baadaab9f6bfc4ff929eb2fd4978e98abf7a4fb [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2014 The Chromium Authors
[email protected]553ee5ae2014-04-22 00:19:192// 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"
maxbogue455a57e32016-08-14 00:08:3212#include "components/sync/driver/data_type_controller.h"
[email protected]553ee5ae2014-04-22 00:19:1913
zea9276f212015-08-29 01:35:0314namespace invalidation {
15class InvalidationService;
16} // namespace invalidation
17
zea5758a242015-08-18 05:06:2018namespace syncer {
[email protected]553ee5ae2014-04-22 00:19:1919
zea9276f212015-08-29 01:35:0320class DataTypeEncryptionHandler;
zea9276f212015-08-29 01:35:0321class DataTypeManager;
22class DataTypeManagerObserver;
Mikel Astizacaea41d2021-08-05 09:48:2223class ModelTypeConfigurer;
maxbogue6dcda762016-12-05 20:45:5624class SyncEngine;
Rushan Suleymanovd5c5ef52020-07-30 13:07:2425class SyncInvalidationsService;
zea9276f212015-08-29 01:35:0326
[email protected]553ee5ae2014-04-22 00:19:1927// This factory provides sync driver code with the model type specific sync/api
28// service (like SyncableService) implementations.
29class SyncApiComponentFactory {
30 public:
Marc Treib8c8f4b32021-05-27 17:53:4731 virtual ~SyncApiComponentFactory() = default;
[email protected]0ae5be32014-05-20 06:14:5432
Marc Treibf699c4d2018-05-11 11:42:0533 virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
maxbogue7e006db2016-10-03 19:48:2834 const DataTypeController::TypeMap* controllers,
35 const DataTypeEncryptionHandler* encryption_handler,
maxbogue27ff55902016-12-08 01:38:1436 ModelTypeConfigurer* configurer,
maxbogue7e006db2016-10-03 19:48:2837 DataTypeManagerObserver* observer) = 0;
zea9276f212015-08-29 01:35:0338
Rushan Suleymanovd5c5ef52020-07-30 13:07:2439 // Creating this in the factory helps us mock it out in testing. |invalidator|
40 // and |sync_invalidation_service| are different invalidations. SyncEngine
41 // handles incoming invalidations from both of them (if provided).
42 // |sync_invalidation_service| is a new sync-specific invalidations service
Rushan Suleymanov137294e2023-01-05 11:29:0143 // and must not be null. In future, there will be only one invalidation
44 // service.
Marc Treibf699c4d2018-05-11 11:42:0545 virtual std::unique_ptr<SyncEngine> CreateSyncEngine(
zea9276f212015-08-29 01:35:0346 const std::string& name,
47 invalidation::InvalidationService* invalidator,
Rushan Suleymanov137294e2023-01-05 11:29:0148 SyncInvalidationsService* sync_invalidation_service) = 0;
Victor Hugo Vianna Silva29c30192020-10-15 18:54:0449
Mikel Astizc959c65d2021-05-03 18:49:1550 // Clears all local transport data. Upon calling this, the deletion is
51 // guaranteed to finish before a new engine returned by |CreateSyncEngine()|
52 // can do any proper work.
53 virtual void ClearAllTransportData() = 0;
[email protected]553ee5ae2014-04-22 00:19:1954};
55
maxbogue7e006db2016-10-03 19:48:2856} // namespace syncer
[email protected]553ee5ae2014-04-22 00:19:1957
58#endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_