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

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 class WebDataService; 24 class WebDataService;
24 25
25 namespace browser_sync { 26 namespace browser_sync {
26 class DataTypeManager; 27 class DataTypeManager;
28 class GenericChangeProcessor;
29 class SharedChangeProcessor;
27 class SyncBackendHost; 30 class SyncBackendHost;
28 class UnrecoverableErrorHandler; 31 class UnrecoverableErrorHandler;
29 } 32 }
30 33
31 namespace history { 34 namespace history {
32 class HistoryBackend; 35 class HistoryBackend;
33 }; 36 };
34 37
35 // Factory class for all profile sync related classes. 38 // Factory class for all profile sync related classes.
36 class ProfileSyncFactory { 39 class ProfileSyncFactory {
37 public: 40 public:
38 // The various factory methods for the data type model associators 41 // The various factory methods for the data type model associators
39 // and change processors all return this struct. This is needed 42 // and change processors all return this struct. This is needed
40 // because the change processors typically require a type-specific 43 // because the change processors typically require a type-specific
41 // model associator at construction time. 44 // model associator at construction time.
45 //
46 // Note: This interface is deprecated in favor of the SyncableService API.
47 // New datatypes that do not live on the UI thread should directly return a
48 // weak pointer to a SyncableService. All others continue to return
49 // SyncComponents. It is safe to assume that the factory methods below are
50 // called on the same thread in which the datatype resides.
51 //
52 // TODO(zea): Have all datatypes using the new API switch to returning
53 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114).
42 struct SyncComponents { 54 struct SyncComponents {
43 browser_sync::AssociatorInterface* model_associator; 55 browser_sync::AssociatorInterface* model_associator;
44 browser_sync::ChangeProcessor* change_processor; 56 browser_sync::ChangeProcessor* change_processor;
45 SyncComponents(browser_sync::AssociatorInterface* ma, 57 SyncComponents(browser_sync::AssociatorInterface* ma,
46 browser_sync::ChangeProcessor* cp) 58 browser_sync::ChangeProcessor* cp)
47 : model_associator(ma), change_processor(cp) {} 59 : model_associator(ma), change_processor(cp) {}
48 }; 60 };
49 61
50 virtual ~ProfileSyncFactory() {} 62 virtual ~ProfileSyncFactory() {}
51 63
52 // Instantiates a new ProfileSyncService. The return pointer is owned by the 64 // Instantiates a new ProfileSyncService. The return pointer is owned by the
53 // caller. 65 // caller.
54 virtual ProfileSyncService* CreateProfileSyncService( 66 virtual ProfileSyncService* CreateProfileSyncService(
55 const std::string& cros_user) = 0; 67 const std::string& cros_user) = 0;
56 68
57 // Creates and registers enabled datatypes with the provided 69 // Creates and registers enabled datatypes with the provided
58 // ProfileSyncService. 70 // ProfileSyncService.
59 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0; 71 virtual void RegisterDataTypes(ProfileSyncService* pss) = 0;
60 72
61 // Instantiates a new DataTypeManager with a SyncBackendHost and a 73 // Instantiates a new DataTypeManager with a SyncBackendHost and a
62 // list of data type controllers. The return pointer is owned by 74 // list of data type controllers. The return pointer is owned by
63 // the caller. 75 // the caller.
64 virtual browser_sync::DataTypeManager* CreateDataTypeManager( 76 virtual browser_sync::DataTypeManager* CreateDataTypeManager(
65 browser_sync::SyncBackendHost* backend, 77 browser_sync::SyncBackendHost* backend,
66 const browser_sync::DataTypeController::TypeMap* controllers) = 0; 78 const browser_sync::DataTypeController::TypeMap* controllers) = 0;
67 79
80 virtual browser_sync::GenericChangeProcessor* CreateGenericChangeProcessor(
81 ProfileSyncService* profile_sync_service,
82 browser_sync::UnrecoverableErrorHandler* error_handler,
83 const base::WeakPtr<SyncableService>& local_service) = 0;
84
85 virtual browser_sync::SharedChangeProcessor*
86 CreateSharedChangeProcessor() = 0;
87
68 // Instantiates both a model associator and change processor for the 88 // Instantiates both a model associator and change processor for the
69 // app data type. The pointers in the return struct are 89 // app data type. The pointers in the return struct are
70 // owned by the caller. 90 // owned by the caller.
71 virtual SyncComponents CreateAppSyncComponents( 91 virtual SyncComponents CreateAppSyncComponents(
72 ProfileSyncService* profile_sync_service, 92 ProfileSyncService* profile_sync_service,
73 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 93 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
74 94
75 // Instantiates both a model associator and change processor for the 95 // Instantiates both a model associator and change processor for the
76 // autofill data type. The pointers in the return struct are owned 96 // autofill data type. The pointers in the return struct are owned
77 // by the caller. 97 // by the caller.
78 virtual SyncComponents CreateAutofillSyncComponents( 98 virtual SyncComponents CreateAutofillSyncComponents(
79 ProfileSyncService* profile_sync_service, 99 ProfileSyncService* profile_sync_service,
80 WebDatabase* web_database, 100 WebDatabase* web_database,
81 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 101 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
82 102
83 // Instantiates both a model associator and change processor for the 103 // Returns a weak pointer to the SyncableService associated with the datatype.
84 // autofill data type. The pointers in the return struct are owned 104 // The SyncableService is not owned by Sync, but by the backend service
85 // by the caller. 105 // itself.
86 virtual SyncComponents CreateAutofillProfileSyncComponents( 106 virtual base::WeakPtr<SyncableService> GetAutofillProfileSyncableService(
87 ProfileSyncService* profile_sync_service, 107 WebDataService* web_data_service) = 0;
88 WebDataService* web_data_service,
89 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
90 108
91 // Instantiates both a model associator and change processor for the 109 // Instantiates both a model associator and change processor for the
92 // bookmark data type. The pointers in the return struct are owned 110 // bookmark data type. The pointers in the return struct are owned
93 // by the caller. 111 // by the caller.
94 virtual SyncComponents CreateBookmarkSyncComponents( 112 virtual SyncComponents CreateBookmarkSyncComponents(
95 ProfileSyncService* profile_sync_service, 113 ProfileSyncService* profile_sync_service,
96 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 114 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
97 115
98 // Instantiates both a model associator and change processor for the 116 // Instantiates both a model associator and change processor for the
99 // extension setting data type. The pointers in the return struct are 117 // extension setting data type. The pointers in the return struct are
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 167
150 // Instantiates both a model associator and change processor for the search 168 // Instantiates both a model associator and change processor for the search
151 // engine data type. The pointers in the return struct are owned by the 169 // engine data type. The pointers in the return struct are owned by the
152 // caller. 170 // caller.
153 virtual SyncComponents CreateSearchEngineSyncComponents( 171 virtual SyncComponents CreateSearchEngineSyncComponents(
154 ProfileSyncService* profile_sync_service, 172 ProfileSyncService* profile_sync_service,
155 browser_sync::UnrecoverableErrorHandler* error_handler) = 0; 173 browser_sync::UnrecoverableErrorHandler* error_handler) = 0;
156 }; 174 };
157 175
158 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__ 176 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_FACTORY_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698