Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: components/sync_driver/profile_sync_components_factory.h

Issue 1310553005: [Sync] Replace ProfileSyncComponentsFactory with SyncClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really fix GN Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_PROFILE_SYNC_COMPONENTS_FACTORY_H__
6 #define COMPONENTS_SYNC_DRIVER_PROFILE_SYNC_COMPONENTS_FACTORY_H__
7
8 #include <string>
9
10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "components/sync_driver/data_type_controller.h"
14 #include "components/sync_driver/sync_api_component_factory.h"
15 #include "sync/internal_api/public/util/weak_handle.h"
16
17 class PasswordStore;
18 class Profile;
19 class ProfileSyncService;
20
21 namespace browser_sync {
22 class SyncBackendHost;
23 } // namespace browser_sync
24
25 namespace invalidation {
26 class InvalidationService;
27 } // namespace invalidation
28
29 namespace sync_driver {
30 class AssociatorInterface;
31 class ChangeProcessor;
32 class DataTypeEncryptionHandler;
33 class DataTypeErrorHandler;
34 class DataTypeManager;
35 class DataTypeManagerObserver;
36 class DataTypeStatusTable;
37 class GenericChangeProcessor;
38 class LocalDeviceInfoProvider;
39 class SyncPrefs;
40 } // namespace sync_driver
41
42 namespace syncer {
43 class DataTypeDebugInfoListener;
44 class SyncableService;
45 } // namespace syncer
46
47 namespace history {
48 class HistoryBackend;
49 } // namespace history
50
51 // Factory class for all profile sync related classes.
52 // TODO(zea): crbug.com/512768 Delete this interface and move all methods into
53 // SyncApiComponentFactory.
54 class ProfileSyncComponentsFactory
55 : public sync_driver::SyncApiComponentFactory {
56 public:
57 // The various factory methods for the data type model associators
58 // and change processors all return this struct. This is needed
59 // because the change processors typically require a type-specific
60 // model associator at construction time.
61 //
62 // Note: This interface is deprecated in favor of the SyncableService API.
63 // New datatypes that do not live on the UI thread should directly return a
64 // weak pointer to a syncer::SyncableService. All others continue to return
65 // SyncComponents. It is safe to assume that the factory methods below are
66 // called on the same thread in which the datatype resides.
67 //
68 // TODO(zea): Have all datatypes using the new API switch to returning
69 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114).
70 struct SyncComponents {
71 sync_driver::AssociatorInterface* model_associator;
72 sync_driver::ChangeProcessor* change_processor;
73 SyncComponents(sync_driver::AssociatorInterface* ma,
74 sync_driver::ChangeProcessor* cp)
75 : model_associator(ma), change_processor(cp) {}
76 };
77
78 ~ProfileSyncComponentsFactory() override {}
79
80 // Creates and registers enabled datatypes with the provided
81 // ProfileSyncService.
82 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0;
83
84 // Instantiates a new DataTypeManager with a SyncBackendHost, a list of data
85 // type controllers and a DataTypeManagerObserver. The return pointer is
86 // owned by the caller.
87 virtual sync_driver::DataTypeManager* CreateDataTypeManager(
88 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
89 debug_info_listener,
90 const sync_driver::DataTypeController::TypeMap* controllers,
91 const sync_driver::DataTypeEncryptionHandler* encryption_handler,
92 browser_sync::SyncBackendHost* backend,
93 sync_driver::DataTypeManagerObserver* observer) = 0;
94
95 // Creating this in the factory helps us mock it out in testing.
96 virtual browser_sync::SyncBackendHost* CreateSyncBackendHost(
97 const std::string& name,
98 Profile* profile,
99 invalidation::InvalidationService* invalidator,
100 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
101 const base::FilePath& sync_folder) = 0;
102
103 // Creating this in the factory helps us mock it out in testing.
104 virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider>
105 CreateLocalDeviceInfoProvider() = 0;
106
107 // Legacy datatypes that need to be converted to the SyncableService API.
108 virtual SyncComponents CreateBookmarkSyncComponents(
109 ProfileSyncService* profile_sync_service,
110 sync_driver::DataTypeErrorHandler* error_handler) = 0;
111 virtual SyncComponents CreateTypedUrlSyncComponents(
112 ProfileSyncService* profile_sync_service,
113 history::HistoryBackend* history_backend,
114 sync_driver::DataTypeErrorHandler* error_handler) = 0;
115 };
116
117 #endif // COMPONENTS_SYNC_DRIVER_PROFILE_SYNC_COMPONENTS_FACTORY_H__
OLDNEW
« no previous file with comments | « components/sync_driver/non_ui_data_type_controller_unittest.cc ('k') | components/sync_driver/shared_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698