blob: b0bfa739a7d149e84c69bef54aa08d235340d406 [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
[email protected]553ee5ae2014-04-22 00:19:1911#include "base/memory/weak_ptr.h"
Max Boguefef332d2016-07-28 22:09:0912#include "components/sync/base/model_type.h"
Marc Treiba14e1eb2019-10-21 12:39:0913#include "components/sync/base/weak_handle.h"
maxbogue455a57e32016-08-14 00:08:3214#include "components/sync/driver/data_type_controller.h"
[email protected]553ee5ae2014-04-22 00:19:1915
zea9276f212015-08-29 01:35:0316namespace invalidation {
17class InvalidationService;
18} // namespace invalidation
19
zea5758a242015-08-18 05:06:2020namespace syncer {
[email protected]553ee5ae2014-04-22 00:19:1921
maxbogue7e006db2016-10-03 19:48:2822class DataTypeDebugInfoListener;
zea9276f212015-08-29 01:35:0323class DataTypeEncryptionHandler;
zea9276f212015-08-29 01:35:0324class DataTypeManager;
25class DataTypeManagerObserver;
maxbogue6dcda762016-12-05 20:45:5626class SyncEngine;
maxbogue7e006db2016-10-03 19:48:2827class SyncPrefs;
zea9276f212015-08-29 01:35:0328
[email protected]553ee5ae2014-04-22 00:19:1929// This factory provides sync driver code with the model type specific sync/api
30// service (like SyncableService) implementations.
31class SyncApiComponentFactory {
32 public:
[email protected]0ae5be32014-05-20 06:14:5433 virtual ~SyncApiComponentFactory() {}
[email protected]0ae5be32014-05-20 06:14:5434
Marc Treibf699c4d2018-05-11 11:42:0535 virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager(
maxbogue27ff55902016-12-08 01:38:1436 ModelTypeSet initial_types,
maxbogue7e006db2016-10-03 19:48:2837 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
38 const DataTypeController::TypeMap* controllers,
39 const DataTypeEncryptionHandler* encryption_handler,
maxbogue27ff55902016-12-08 01:38:1440 ModelTypeConfigurer* configurer,
maxbogue7e006db2016-10-03 19:48:2841 DataTypeManagerObserver* observer) = 0;
zea9276f212015-08-29 01:35:0342
43 // Creating this in the factory helps us mock it out in testing.
Marc Treibf699c4d2018-05-11 11:42:0544 virtual std::unique_ptr<SyncEngine> CreateSyncEngine(
zea9276f212015-08-29 01:35:0345 const std::string& name,
46 invalidation::InvalidationService* invalidator,
Mikel Astiz83b96632019-02-11 10:25:1747 const base::WeakPtr<SyncPrefs>& sync_prefs) = 0;
[email protected]553ee5ae2014-04-22 00:19:1948};
49
maxbogue7e006db2016-10-03 19:48:2850} // namespace syncer
[email protected]553ee5ae2014-04-22 00:19:1951
52#endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_