blob: 66b076fe798c3fa5b8a639b294c4d40f6f63cae3 [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
Mikel Astiz91c345c2023-05-16 14:18:565#ifndef COMPONENTS_SYNC_SERVICE_SYNC_API_COMPONENT_FACTORY_H_
6#define COMPONENTS_SYNC_SERVICE_SYNC_API_COMPONENT_FACTORY_H_
[email protected]553ee5ae2014-04-22 00:19:197
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"
Mikel Astiz91c345c2023-05-16 14:18:5612#include "components/sync/service/data_type_controller.h"
[email protected]553ee5ae2014-04-22 00:19:1913
zea5758a242015-08-18 05:06:2014namespace syncer {
[email protected]553ee5ae2014-04-22 00:19:1915
zea9276f212015-08-29 01:35:0316class DataTypeEncryptionHandler;
zea9276f212015-08-29 01:35:0317class DataTypeManager;
18class DataTypeManagerObserver;
Mikel Astizacaea41d2021-08-05 09:48:2219class ModelTypeConfigurer;
maxbogue6dcda762016-12-05 20:45:5620class SyncEngine;
Rushan Suleymanovd5c5ef52020-07-30 13:07:2421class SyncInvalidationsService;
zea9276f212015-08-29 01:35:0322
Mikel Astiz91c345c2023-05-16 14:18:5623// This factory provides sync service code with the model type specific sync/api
[email protected]553ee5ae2014-04-22 00:19:1924// service (like SyncableService) implementations.
25class SyncApiComponentFactory {
26 public:
Marc Treib8c8f4b32021-05-27 17:53:4727 virtual ~SyncApiComponentFactory() = default;
[email protected]0ae5be32014-05-20 06:14:5428
Marc Treibf699c4d2018-05-11 11:42:0529 virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
maxbogue7e006db2016-10-03 19:48:2830 const DataTypeController::TypeMap* controllers,
31 const DataTypeEncryptionHandler* encryption_handler,
maxbogue27ff55902016-12-08 01:38:1432 ModelTypeConfigurer* configurer,
maxbogue7e006db2016-10-03 19:48:2833 DataTypeManagerObserver* observer) = 0;
zea9276f212015-08-29 01:35:0334
Rushan Suleymanov1b4c9d02023-07-26 07:21:3335 // Creating this in the factory helps us mock it out in testing.
Mikel Astiz527d0a1e2023-09-22 12:05:3536 // `sync_invalidation_service` must not be null.
Marc Treibf699c4d2018-05-11 11:42:0537 virtual std::unique_ptr<SyncEngine> CreateSyncEngine(
zea9276f212015-08-29 01:35:0338 const std::string& name,
Rushan Suleymanov137294e2023-01-05 11:29:0139 SyncInvalidationsService* sync_invalidation_service) = 0;
Victor Hugo Vianna Silva29c30192020-10-15 18:54:0440
Mikel Astiz527d0a1e2023-09-22 12:05:3541 // Returns whether the local transport data indicates that a sync engine
42 // previously initialized successfully and hence populated at least some
43 // transport data (e.g. birthday). It also implies that the client
44 // successfully communicated to the server at least once.
45 virtual bool HasTransportDataIncludingFirstSync() = 0;
46
Mikel Astizc959c65d2021-05-03 18:49:1547 // Clears all local transport data. Upon calling this, the deletion is
Mikel Astiz527d0a1e2023-09-22 12:05:3548 // guaranteed to finish before a new engine returned by `CreateSyncEngine()`
Mikel Astizc959c65d2021-05-03 18:49:1549 // can do any proper work.
50 virtual void ClearAllTransportData() = 0;
[email protected]553ee5ae2014-04-22 00:19:1951};
52
maxbogue7e006db2016-10-03 19:48:2853} // namespace syncer
[email protected]553ee5ae2014-04-22 00:19:1954
Mikel Astiz91c345c2023-05-16 14:18:5655#endif // COMPONENTS_SYNC_SERVICE_SYNC_API_COMPONENT_FACTORY_H_