blob: 2f99a6b398d2092d954ec9eeec0fc9dbec9a94b9 [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"
Marc Treiba2fa834d2024-03-27 09:17:5112#include "components/sync/service/model_type_controller.h"
[email protected]553ee5ae2014-04-22 00:19:1913
Marc Treibd2917512024-05-16 11:24:5814namespace signin {
15class GaiaIdHash;
16}
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;
maxbogue6dcda762016-12-05 20:45:5623class SyncEngine;
Rushan Suleymanovd5c5ef52020-07-30 13:07:2424class SyncInvalidationsService;
zea9276f212015-08-29 01:35:0325
Mikel Astiz91c345c2023-05-16 14:18:5626// This factory provides sync service code with the model type specific sync/api
[email protected]553ee5ae2014-04-22 00:19:1927// service (like SyncableService) implementations.
28class SyncApiComponentFactory {
29 public:
Marc Treib8c8f4b32021-05-27 17:53:4730 virtual ~SyncApiComponentFactory() = default;
[email protected]0ae5be32014-05-20 06:14:5431
Marc Treibf699c4d2018-05-11 11:42:0532 virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
Marc Treib2182c9e2024-03-25 16:58:2333 const ModelTypeController::TypeMap* controllers,
maxbogue7e006db2016-10-03 19:48:2834 const DataTypeEncryptionHandler* encryption_handler,
maxbogue7e006db2016-10-03 19:48:2835 DataTypeManagerObserver* observer) = 0;
zea9276f212015-08-29 01:35:0336
Rushan Suleymanov1b4c9d02023-07-26 07:21:3337 // Creating this in the factory helps us mock it out in testing.
Mikel Astiz527d0a1e2023-09-22 12:05:3538 // `sync_invalidation_service` must not be null.
Marc Treibf699c4d2018-05-11 11:42:0539 virtual std::unique_ptr<SyncEngine> CreateSyncEngine(
zea9276f212015-08-29 01:35:0340 const std::string& name,
Marc Treibd2917512024-05-16 11:24:5841 const signin::GaiaIdHash& gaia_id_hash,
Rushan Suleymanov137294e2023-01-05 11:29:0142 SyncInvalidationsService* sync_invalidation_service) = 0;
Victor Hugo Vianna Silva29c30192020-10-15 18:54:0443
Mikel Astiz527d0a1e2023-09-22 12:05:3544 // Returns whether the local transport data indicates that a sync engine
45 // previously initialized successfully and hence populated at least some
46 // transport data (e.g. birthday). It also implies that the client
47 // successfully communicated to the server at least once.
Marc Treibd2917512024-05-16 11:24:5848 virtual bool HasTransportDataIncludingFirstSync(
49 const signin::GaiaIdHash& gaia_id_hash) = 0;
Mikel Astiz527d0a1e2023-09-22 12:05:3550
Marc Treibd2917512024-05-16 11:24:5851 // Cleans up potentially-leftover sync data. Usually the SyncEngine is
52 // responsible for that; this is meant to be called if sync gets disabled
53 // while the engine doesn't exist.
54 virtual void CleanupOnDisableSync() = 0;
55
56 // Clears local transport data (cache GUID etc) for the given account.
57 virtual void ClearTransportDataForAccount(
58 const signin::GaiaIdHash& gaia_id_hash) = 0;
[email protected]553ee5ae2014-04-22 00:19:1959};
60
maxbogue7e006db2016-10-03 19:48:2861} // namespace syncer
[email protected]553ee5ae2014-04-22 00:19:1962
Mikel Astiz91c345c2023-05-16 14:18:5663#endif // COMPONENTS_SYNC_SERVICE_SYNC_API_COMPONENT_FACTORY_H_