OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/sync/glue/data_type_controller.h" | 11 #include "chrome/browser/sync/glue/data_type_controller.h" |
12 #include "chrome/browser/sync/unrecoverable_error_handler.h" | 12 #include "chrome/browser/sync/unrecoverable_error_handler.h" |
13 | 13 |
14 class PasswordStore; | 14 class PasswordStore; |
15 class ProfileSyncService; | 15 class ProfileSyncService; |
16 class SyncableService; | 16 class SyncableService; |
17 class WebDataService; | 17 class WebDataService; |
18 | 18 |
19 namespace browser_sync { | 19 namespace browser_sync { |
20 class AssociatorInterface; | 20 class AssociatorInterface; |
21 class ChangeProcessor; | 21 class ChangeProcessor; |
22 class DataTypeManager; | 22 class DataTypeManager; |
23 class GenericChangeProcessor; | 23 class GenericChangeProcessor; |
24 class SharedChangeProcessor; | 24 class SharedChangeProcessor; |
25 class SyncBackendHost; | 25 class SyncBackendHost; |
26 class UnrecoverableErrorHandler; | 26 class UnrecoverableErrorHandler; |
27 } | 27 } |
28 | 28 |
29 namespace history { | 29 namespace history { |
30 class HistoryBackend; | 30 class HistoryBackend; |
31 }; | 31 }; |
32 | 32 |
33 // Factory class for all profile sync related classes. | 33 // Factory class for all profile sync related classes. |
34 class ProfileSyncFactory { | 34 class ProfileSyncComponentsFactory { |
35 public: | 35 public: |
36 // The various factory methods for the data type model associators | 36 // The various factory methods for the data type model associators |
37 // and change processors all return this struct. This is needed | 37 // and change processors all return this struct. This is needed |
38 // because the change processors typically require a type-specific | 38 // because the change processors typically require a type-specific |
39 // model associator at construction time. | 39 // model associator at construction time. |
40 // | 40 // |
41 // Note: This interface is deprecated in favor of the SyncableService API. | 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 | 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 | 43 // weak pointer to a SyncableService. All others continue to return |
44 // SyncComponents. It is safe to assume that the factory methods below are | 44 // SyncComponents. It is safe to assume that the factory methods below are |
45 // called on the same thread in which the datatype resides. | 45 // called on the same thread in which the datatype resides. |
46 // | 46 // |
47 // TODO(zea): Have all datatypes using the new API switch to returning | 47 // TODO(zea): Have all datatypes using the new API switch to returning |
48 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114). | 48 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114). |
49 struct SyncComponents { | 49 struct SyncComponents { |
50 browser_sync::AssociatorInterface* model_associator; | 50 browser_sync::AssociatorInterface* model_associator; |
51 browser_sync::ChangeProcessor* change_processor; | 51 browser_sync::ChangeProcessor* change_processor; |
52 SyncComponents(browser_sync::AssociatorInterface* ma, | 52 SyncComponents(browser_sync::AssociatorInterface* ma, |
53 browser_sync::ChangeProcessor* cp) | 53 browser_sync::ChangeProcessor* cp) |
54 : model_associator(ma), change_processor(cp) {} | 54 : model_associator(ma), change_processor(cp) {} |
55 }; | 55 }; |
56 | 56 |
57 virtual ~ProfileSyncFactory() {} | 57 virtual ~ProfileSyncComponentsFactory() {} |
58 | 58 |
59 // Instantiates a new ProfileSyncService. The return pointer is owned by the | 59 // Instantiates a new ProfileSyncService. The return pointer is owned by the |
60 // caller. | 60 // caller. |
| 61 // TODO(tim): Bug 93922. Remove this method in favor of a |
| 62 // ProfileSyncServiceFactory singleton. |
61 virtual ProfileSyncService* CreateProfileSyncService( | 63 virtual ProfileSyncService* CreateProfileSyncService( |
62 const std::string& cros_user) = 0; | 64 const std::string& cros_user) = 0; |
63 | 65 |
64 // Creates and registers enabled datatypes with the provided | 66 // Creates and registers enabled datatypes with the provided |
65 // ProfileSyncService. | 67 // ProfileSyncService. |
66 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0; | 68 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0; |
67 | 69 |
68 // Instantiates a new DataTypeManager with a SyncBackendHost and a | 70 // Instantiates a new DataTypeManager with a SyncBackendHost and a |
69 // list of data type controllers. The return pointer is owned by | 71 // list of data type controllers. The return pointer is owned by |
70 // the caller. | 72 // the caller. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; | 171 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; |
170 | 172 |
171 // Instantiates both a model associator and change processor for the app | 173 // 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 | 174 // notification data type. The pointers in the return struct are owned by the |
173 // caller. | 175 // caller. |
174 virtual SyncComponents CreateAppNotificationSyncComponents( | 176 virtual SyncComponents CreateAppNotificationSyncComponents( |
175 ProfileSyncService* profile_sync_service, | 177 ProfileSyncService* profile_sync_service, |
176 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; | 178 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; |
177 }; | 179 }; |
178 | 180 |
179 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ | 181 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_H__ |
OLD | NEW |