[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 1 | // 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 | |||||
dcheng | b21a1b1 | 2016-04-21 19:23:13 | [diff] [blame] | 8 | #include <memory> |
skym | 9dbfbcf | 2015-10-09 18:44:33 | [diff] [blame] | 9 | #include <string> |
10 | |||||
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 11 | #include "base/memory/weak_ptr.h" |
Max Bogue | fef332d | 2016-07-28 22:09:09 | [diff] [blame] | 12 | #include "components/sync/base/model_type.h" |
Marc Treib | a14e1eb | 2019-10-21 12:39:09 | [diff] [blame^] | 13 | #include "components/sync/base/weak_handle.h" |
maxbogue | 455a57e3 | 2016-08-14 00:08:32 | [diff] [blame] | 14 | #include "components/sync/driver/data_type_controller.h" |
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 15 | |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 16 | namespace invalidation { |
17 | class InvalidationService; | ||||
18 | } // namespace invalidation | ||||
19 | |||||
zea | 5758a24 | 2015-08-18 05:06:20 | [diff] [blame] | 20 | namespace syncer { |
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 21 | |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 22 | class DataTypeDebugInfoListener; |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 23 | class DataTypeEncryptionHandler; |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 24 | class DataTypeManager; |
25 | class DataTypeManagerObserver; | ||||
maxbogue | 6dcda76 | 2016-12-05 20:45:56 | [diff] [blame] | 26 | class SyncEngine; |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 27 | class SyncPrefs; |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 28 | |
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 29 | // This factory provides sync driver code with the model type specific sync/api |
30 | // service (like SyncableService) implementations. | ||||
31 | class SyncApiComponentFactory { | ||||
32 | public: | ||||
[email protected] | 0ae5be3 | 2014-05-20 06:14:54 | [diff] [blame] | 33 | virtual ~SyncApiComponentFactory() {} |
[email protected] | 0ae5be3 | 2014-05-20 06:14:54 | [diff] [blame] | 34 | |
Marc Treib | f699c4d | 2018-05-11 11:42:05 | [diff] [blame] | 35 | virtual std::unique_ptr<DataTypeManager> CreateDataTypeManager( |
maxbogue | 27ff5590 | 2016-12-08 01:38:14 | [diff] [blame] | 36 | ModelTypeSet initial_types, |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 37 | const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, |
38 | const DataTypeController::TypeMap* controllers, | ||||
39 | const DataTypeEncryptionHandler* encryption_handler, | ||||
maxbogue | 27ff5590 | 2016-12-08 01:38:14 | [diff] [blame] | 40 | ModelTypeConfigurer* configurer, |
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 41 | DataTypeManagerObserver* observer) = 0; |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 42 | |
43 | // Creating this in the factory helps us mock it out in testing. | ||||
Marc Treib | f699c4d | 2018-05-11 11:42:05 | [diff] [blame] | 44 | virtual std::unique_ptr<SyncEngine> CreateSyncEngine( |
zea | 9276f21 | 2015-08-29 01:35:03 | [diff] [blame] | 45 | const std::string& name, |
46 | invalidation::InvalidationService* invalidator, | ||||
Mikel Astiz | 83b9663 | 2019-02-11 10:25:17 | [diff] [blame] | 47 | const base::WeakPtr<SyncPrefs>& sync_prefs) = 0; |
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 48 | }; |
49 | |||||
maxbogue | 7e006db | 2016-10-03 19:48:28 | [diff] [blame] | 50 | } // namespace syncer |
[email protected] | 553ee5ae | 2014-04-22 00:19:19 | [diff] [blame] | 51 | |
52 | #endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ |