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

Side by Side Diff: chrome/browser/sync/profile_sync_factory.h

Issue 8596017: sync: rename ProfileSyncFactory to ProfileSyncComponentsFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
7 #pragma once
8
9 #include <string>
10
11 #include "chrome/browser/sync/glue/data_type_controller.h"
12 #include "chrome/browser/sync/unrecoverable_error_handler.h"
13
14 class PasswordStore;
15 class ProfileSyncService;
16 class SyncableService;
17 class WebDataService;
18
19 namespace browser_sync {
20 class AssociatorInterface;
21 class ChangeProcessor;
22 class DataTypeManager;
23 class GenericChangeProcessor;
24 class SharedChangeProcessor;
25 class SyncBackendHost;
26 class UnrecoverableErrorHandler;
27 }
28
29 namespace history {
30 class HistoryBackend;
31 };
32
33 // Factory class for all profile sync related classes.
34 class ProfileSyncFactory {
35 public:
36 // The various factory methods for the data type model associators
37 // and change processors all return this struct. This is needed
38 // because the change processors typically require a type-specific
39 // model associator at construction time.
40 //
41 // Note: This interface is deprecated in favor of the SyncableService API.
42 // New datatypes that do not live on the UI thread should directly return a
43 // weak pointer to a SyncableService. All others continue to return
44 // SyncComponents. It is safe to assume that the factory methods below are
45 // called on the same thread in which the datatype resides.
46 //
47 // TODO(zea): Have all datatypes using the new API switch to returning
48 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114).
49 struct SyncComponents {
50 browser_sync::AssociatorInterface* model_associator;
51 browser_sync::ChangeProcessor* change_processor;
52 SyncComponents(browser_sync::AssociatorInterface* ma,
53 browser_sync::ChangeProcessor* cp)
54 : model_associator(ma), change_processor(cp) {}
55 };
56
57 virtual ~ProfileSyncFactory() {}
58
59 // Instantiates a new ProfileSyncService. The return pointer is owned by the
60 // caller.
61 virtual ProfileSyncService* CreateProfileSyncService(
62 const std::string& cros_user) = 0;
63
64 // Creates and registers enabled datatypes with the provided
65 // ProfileSyncService.
66 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0;
67
68 // Instantiates a new DataTypeManager with a SyncBackendHost and a
69 // list of data type controllers. The return pointer is owned by
70 // the caller.
71 virtual browser_sync::DataTypeManager* CreateDataTypeManager(
72 browser_sync::SyncBackendHost* backend,
73 const browser_sync::DataTypeController::TypeMap* controllers) = 0;
74
75 // Creating this in the factory helps us mock it out in testing.
76 virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor(
77 ProfileSyncService* profile_sync_service,
78 browser_sync::UnrecoverableErrorHandler* error_handler,
79 const base::WeakPtr<SyncableService>& local_service) = 0;
80
81 virtual browser_sync::SharedChangeProcessor*
82 CreateSharedChangeProcessor() = 0;
83
84 // Instantiates both a model associator and change processor for the
85 // app data type. The pointers in the return struct are
86 // owned by the caller.
87 virtual SyncComponents CreateAppSyncComponents(
88 ProfileSyncService* profile_sync_service,
89 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
90
91 // Returns a weak pointer to the SyncableService associated with the datatype.
92 // The SyncableService is not owned by Sync, but by the backend service
93 // itself.
94 virtual base::WeakPtr<SyncableService> GetAutofillProfileSyncableService(
95 WebDataService* web_data_service) const = 0;
96
97 // Returns a weak pointer to the SyncableService associated with the datatype.
98 // The SyncableService is not owned by Sync, but by the backend service
99 // itself.
100 virtual base::WeakPtr<SyncableService> GetAutocompleteSyncableService(
101 WebDataService* web_data_service) const = 0;
102
103 // Instantiates both a model associator and change processor for the
104 // bookmark data type. The pointers in the return struct are owned
105 // by the caller.
106 virtual SyncComponents CreateBookmarkSyncComponents(
107 ProfileSyncService* profile_sync_service,
108 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
109
110 // Instantiates both a model associator and change processor for the
111 // extension or app setting data type. The pointers in the return struct are
112 // owned by the caller.
113 virtual SyncComponents CreateExtensionOrAppSettingSyncComponents(
114 // Either EXTENSION_SETTINGS or APP_SETTINGS.
115 syncable::ModelType type,
116 SyncableService* settings_service,
117 ProfileSyncService* profile_sync_service,
118 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
119
120 // Instantiates both a model associator and change processor for the
121 // extension data type. The pointers in the return struct are
122 // owned by the caller.
123 virtual SyncComponents CreateExtensionSyncComponents(
124 ProfileSyncService* profile_sync_service,
125 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
126
127 // Instantiates both a model associator and change processor for the
128 // password data type. The pointers in the return struct are
129 // owned by the caller.
130 virtual SyncComponents CreatePasswordSyncComponents(
131 ProfileSyncService* profile_sync_service,
132 PasswordStore* password_store,
133 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
134
135 // Instantiates both a model associator and change processor for the
136 // preference data type. The pointers in the return struct are
137 // owned by the caller.
138 virtual SyncComponents CreatePreferenceSyncComponents(
139 ProfileSyncService* profile_sync_service,
140 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
141
142 // Instantiates both a model associator and change processor for the
143 // theme data type. The pointers in the return struct are
144 // owned by the caller.
145 virtual SyncComponents CreateThemeSyncComponents(
146 ProfileSyncService* profile_sync_service,
147 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
148
149 // Instantiates both a model associator and change processor for the
150 // typed_url data type. The pointers in the return struct are owned
151 // by the caller.
152 virtual SyncComponents CreateTypedUrlSyncComponents(
153 ProfileSyncService* profile_sync_service,
154 history::HistoryBackend* history_backend,
155 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
156
157 // Instantiates both a model associator and change processor for the
158 // session data type. The pointers in the return struct are
159 // owned by the caller.
160 virtual SyncComponents CreateSessionSyncComponents(
161 ProfileSyncService* profile_sync_service,
162 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
163
164 // Instantiates both a model associator and change processor for the search
165 // engine data type. The pointers in the return struct are owned by the
166 // caller.
167 virtual SyncComponents CreateSearchEngineSyncComponents(
168 ProfileSyncService* profile_sync_service,
169 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
170
171 // Instantiates both a model associator and change processor for the app
172 // notification data type. The pointers in the return struct are owned by the
173 // caller.
174 virtual SyncComponents CreateAppNotificationSyncComponents(
175 ProfileSyncService* profile_sync_service,
176 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
177 };
178
179 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_components_factory_mock.cc ('k') | chrome/browser/sync/profile_sync_factory_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698