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

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

Issue 8065016: [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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_FACTORY_H__
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "chrome/browser/sync/glue/change_processor.h" 13 #include "chrome/browser/sync/glue/change_processor.h"
14 #include "chrome/browser/sync/glue/data_type_controller.h" 14 #include "chrome/browser/sync/glue/data_type_controller.h"
15 #include "chrome/browser/sync/glue/model_associator.h" 15 #include "chrome/browser/sync/glue/model_associator.h"
16 #include "chrome/browser/sync/unrecoverable_error_handler.h" 16 #include "chrome/browser/sync/unrecoverable_error_handler.h"
17 17
18 class ExtensionSettingsBackend; 18 class ExtensionSettingsBackend;
19 class PasswordStore; 19 class PasswordStore;
20 class PersonalDataManager; 20 class PersonalDataManager;
21 class ProfileSyncService; 21 class ProfileSyncService;
22 class SyncableService;
22 class WebDatabase; 23 class WebDatabase;
23 24
24 namespace browser_sync { 25 namespace browser_sync {
25 class DataTypeManager; 26 class DataTypeManager;
27 class GenericChangeProcessor;
26 class SyncBackendHost; 28 class SyncBackendHost;
27 class UnrecoverableErrorHandler; 29 class UnrecoverableErrorHandler;
28 } 30 }
29 31
30 namespace history { 32 namespace history {
31 class HistoryBackend; 33 class HistoryBackend;
32 }; 34 };
33 35
34 // Factory class for all profile sync related classes. 36 // Factory class for all profile sync related classes.
35 class ProfileSyncFactory { 37 class ProfileSyncFactory {
36 public: 38 public:
37 // The various factory methods for the data type model associators 39 // The various factory methods for the data type model associators
38 // and change processors all return this struct. This is needed 40 // and change processors all return this struct. This is needed
39 // because the change processors typically require a type-specific 41 // because the change processors typically require a type-specific
40 // model associator at construction time. 42 // model associator at construction time.
43 // Note: this interface is deprecated in favor of the SyncableService API.
44 // New datatypes that do not live on the UI thread should directly return a
45 // SyncableService. All others continue to return SyncComponents. It is safe
46 // to assume that the factory methods below are called on the same thread
47 // in which the datatype resides.
48 // TODO(zea): Have all datatypes just return their SyncableService pointers.
41 struct SyncComponents { 49 struct SyncComponents {
42 browser_sync::AssociatorInterface* model_associator; 50 browser_sync::AssociatorInterface* model_associator;
43 browser_sync::ChangeProcessor* change_processor; 51 browser_sync::ChangeProcessor* change_processor;
44 SyncComponents(browser_sync::AssociatorInterface* ma, 52 SyncComponents(browser_sync::AssociatorInterface* ma,
45 browser_sync::ChangeProcessor* cp) 53 browser_sync::ChangeProcessor* cp)
46 : model_associator(ma), change_processor(cp) {} 54 : model_associator(ma), change_processor(cp) {}
47 }; 55 };
48 56
49 virtual ~ProfileSyncFactory() {} 57 virtual ~ProfileSyncFactory() {}
50 58
51 // Instantiates a new ProfileSyncService. The return pointer is owned by the 59 // Instantiates a new ProfileSyncService. The return pointer is owned by the
52 // caller. 60 // caller.
53 virtual ProfileSyncService* CreateProfileSyncService( 61 virtual ProfileSyncService* CreateProfileSyncService(
54 const std::string& cros_user) = 0; 62 const std::string& cros_user) = 0;
55 63
56 // Creates and registers enabled datatypes with the provided 64 // Creates and registers enabled datatypes with the provided
57 // ProfileSyncService. 65 // ProfileSyncService.
58 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0; 66 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0;
59 67
60 // Instantiates a new DataTypeManager with a SyncBackendHost and a 68 // Instantiates a new DataTypeManager with a SyncBackendHost and a
61 // list of data type controllers. The return pointer is owned by 69 // list of data type controllers. The return pointer is owned by
62 // the caller. 70 // the caller.
63 virtual browser_sync::DataTypeManager* CreateDataTypeManager( 71 virtual browser_sync::DataTypeManager* CreateDataTypeManager(
64 browser_sync::SyncBackendHost* backend, 72 browser_sync::SyncBackendHost* backend,
65 const browser_sync::DataTypeController::TypeMap* controllers) = 0; 73 const browser_sync::DataTypeController::TypeMap* controllers) = 0;
66 74
75 virtual browser_sync::GenericChangeProcessor* CreateChangeProcessor(
76 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
77
67 // Instantiates both a model associator and change processor for the 78 // Instantiates both a model associator and change processor for the
68 // app data type. The pointers in the return struct are 79 // app data type. The pointers in the return struct are
69 // owned by the caller. 80 // owned by the caller.
70 virtual SyncComponents CreateAppSyncComponents( 81 virtual SyncComponents CreateAppSyncComponents(
71 ProfileSyncService* profile_sync_service, 82 ProfileSyncService* profile_sync_service,
72 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 83 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
73 84
74 // Instantiates both a model associator and change processor for the 85 // Instantiates both a model associator and change processor for the
75 // autofill data type. The pointers in the return struct are owned 86 // autofill data type. The pointers in the return struct are owned
76 // by the caller. 87 // by the caller.
77 virtual SyncComponents CreateAutofillSyncComponents( 88 virtual SyncComponents CreateAutofillSyncComponents(
78 ProfileSyncService* profile_sync_service, 89 ProfileSyncService* profile_sync_service,
79 WebDatabase* web_database, 90 WebDatabase* web_database,
80 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 91 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
81 92
82 // Instantiates both a model associator and change processor for the 93 // Returns a pointer to the SyncableService associated with the datatype.
83 // autofill data type. The pointers in the return struct are owned 94 // The SyncableService is not owned by Sync, but by the backend service
84 // by the caller. 95 // itself.
85 virtual SyncComponents CreateAutofillProfileSyncComponents( 96 virtual SyncableService* CreateAutofillProfileSyncComponents(
86 ProfileSyncService* profile_sync_service, 97 ProfileSyncService* profile_sync_service,
87 WebDatabase* web_database, 98 WebDatabase* web_database) = 0;
88 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
89 99
90 // Instantiates both a model associator and change processor for the 100 // Instantiates both a model associator and change processor for the
91 // bookmark data type. The pointers in the return struct are owned 101 // bookmark data type. The pointers in the return struct are owned
92 // by the caller. 102 // by the caller.
93 virtual SyncComponents CreateBookmarkSyncComponents( 103 virtual SyncComponents CreateBookmarkSyncComponents(
94 ProfileSyncService* profile_sync_service, 104 ProfileSyncService* profile_sync_service,
95 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 105 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
96 106
97 // Instantiates both a model associator and change processor for the 107 // Instantiates both a model associator and change processor for the
98 // extension setting data type. The pointers in the return struct are 108 // extension setting data type. The pointers in the return struct are
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 158
149 // Instantiates both a model associator and change processor for the search 159 // Instantiates both a model associator and change processor for the search
150 // engine data type. The pointers in the return struct are owned by the 160 // engine data type. The pointers in the return struct are owned by the
151 // caller. 161 // caller.
152 virtual SyncComponents CreateSearchEngineSyncComponents( 162 virtual SyncComponents CreateSearchEngineSyncComponents(
153 ProfileSyncService* profile_sync_service, 163 ProfileSyncService* profile_sync_service,
154 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 164 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
155 }; 165 };
156 166
157 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ 167 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698