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

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

Issue 1421003007: [Sync] Componentize ProfileSyncComponentsFactoryImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix sessions api test Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_
6 #define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ 6 #define COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class LocalDeviceInfoProvider; 50 class LocalDeviceInfoProvider;
51 class SyncPrefs; 51 class SyncPrefs;
52 class SyncClient; 52 class SyncClient;
53 class SyncService; 53 class SyncService;
54 54
55 // This factory provides sync driver code with the model type specific sync/api 55 // This factory provides sync driver code with the model type specific sync/api
56 // service (like SyncableService) implementations. 56 // service (like SyncableService) implementations.
57 class SyncApiComponentFactory { 57 class SyncApiComponentFactory {
58 public: 58 public:
59 virtual ~SyncApiComponentFactory() {} 59 virtual ~SyncApiComponentFactory() {}
60 // Callback to allow platform-specific datatypes to register themselves as
61 // data type controllers.
62 // |disabled_types| and |enabled_types| control the disable/enable state of
63 // types that are on or off by default (respectively).
64 typedef base::Callback<void(syncer::ModelTypeSet disabled_types,
65 syncer::ModelTypeSet enabled_types)>
66 RegisterDataTypesMethod;
60 67
61 // The various factory methods for the data type model associators 68 // The various factory methods for the data type model associators
62 // and change processors all return this struct. This is needed 69 // and change processors all return this struct. This is needed
63 // because the change processors typically require a type-specific 70 // because the change processors typically require a type-specific
64 // model associator at construction time. 71 // model associator at construction time.
65 // 72 //
66 // Note: This interface is deprecated in favor of the SyncableService API. 73 // Note: This interface is deprecated in favor of the SyncableService API.
67 // New datatypes that do not live on the UI thread should directly return a 74 // New datatypes that do not live on the UI thread should directly return a
68 // weak pointer to a syncer::SyncableService. All others continue to return 75 // weak pointer to a syncer::SyncableService. All others continue to return
69 // SyncComponents. It is safe to assume that the factory methods below are 76 // SyncComponents. It is safe to assume that the factory methods below are
70 // called on the same thread in which the datatype resides. 77 // called on the same thread in which the datatype resides.
71 // 78 //
72 // TODO(zea): Have all datatypes using the new API switch to returning 79 // TODO(zea): Have all datatypes using the new API switch to returning
73 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114). 80 // SyncableService weak pointers instead of SyncComponents (crbug.com/100114).
74 struct SyncComponents { 81 struct SyncComponents {
75 sync_driver::AssociatorInterface* model_associator; 82 sync_driver::AssociatorInterface* model_associator;
76 sync_driver::ChangeProcessor* change_processor; 83 sync_driver::ChangeProcessor* change_processor;
77 SyncComponents(sync_driver::AssociatorInterface* ma, 84 SyncComponents(sync_driver::AssociatorInterface* ma,
78 sync_driver::ChangeProcessor* cp) 85 sync_driver::ChangeProcessor* cp)
79 : model_associator(ma), change_processor(cp) {} 86 : model_associator(ma), change_processor(cp) {}
80 }; 87 };
81 88
82 // Creates and registers enabled datatypes with the provided SyncClient. 89 // Creates and registers enabled datatypes with the provided SyncClient.
83 virtual void RegisterDataTypes(sync_driver::SyncClient* sync_client) = 0; 90 virtual void RegisterDataTypes(
91 const RegisterDataTypesMethod& register_platform_types_method) = 0;
84 92
85 // Instantiates a new DataTypeManager with a SyncBackendHost, a list of data 93 // Instantiates a new DataTypeManager with a SyncBackendHost, a list of data
86 // type controllers and a DataTypeManagerObserver. The return pointer is 94 // type controllers and a DataTypeManagerObserver. The return pointer is
87 // owned by the caller. 95 // owned by the caller.
88 virtual sync_driver::DataTypeManager* CreateDataTypeManager( 96 virtual sync_driver::DataTypeManager* CreateDataTypeManager(
89 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& 97 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
90 debug_info_listener, 98 debug_info_listener,
91 const sync_driver::DataTypeController::TypeMap* controllers, 99 const sync_driver::DataTypeController::TypeMap* controllers,
92 const sync_driver::DataTypeEncryptionHandler* encryption_handler, 100 const sync_driver::DataTypeEncryptionHandler* encryption_handler,
93 browser_sync::SyncBackendHost* backend, 101 browser_sync::SyncBackendHost* backend,
94 sync_driver::DataTypeManagerObserver* observer) = 0; 102 sync_driver::DataTypeManagerObserver* observer) = 0;
95 103
96 // Creating this in the factory helps us mock it out in testing. 104 // Creating this in the factory helps us mock it out in testing.
97 virtual browser_sync::SyncBackendHost* CreateSyncBackendHost( 105 virtual browser_sync::SyncBackendHost* CreateSyncBackendHost(
98 const std::string& name, 106 const std::string& name,
99 SyncClient* sync_client,
100 invalidation::InvalidationService* invalidator, 107 invalidation::InvalidationService* invalidator,
101 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, 108 const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
102 const base::FilePath& sync_folder) = 0; 109 const base::FilePath& sync_folder) = 0;
103 110
104 // Creating this in the factory helps us mock it out in testing. 111 // Creating this in the factory helps us mock it out in testing.
105 virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider> 112 virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider>
106 CreateLocalDeviceInfoProvider() = 0; 113 CreateLocalDeviceInfoProvider() = 0;
107 114
108 // Legacy datatypes that need to be converted to the SyncableService API. 115 // Legacy datatypes that need to be converted to the SyncableService API.
109 virtual SyncComponents CreateBookmarkSyncComponents( 116 virtual SyncComponents CreateBookmarkSyncComponents(
(...skipping 19 matching lines...) Expand all
129 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store, 136 scoped_ptr<syncer::AttachmentStoreForSync> attachment_store,
130 const syncer::UserShare& user_share, 137 const syncer::UserShare& user_share,
131 const std::string& store_birthday, 138 const std::string& store_birthday,
132 syncer::ModelType model_type, 139 syncer::ModelType model_type,
133 syncer::AttachmentService::Delegate* delegate) = 0; 140 syncer::AttachmentService::Delegate* delegate) = 0;
134 }; 141 };
135 142
136 } // namespace sync_driver 143 } // namespace sync_driver
137 144
138 #endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_ 145 #endif // COMPONENTS_SYNC_DRIVER_SYNC_API_COMPONENT_FACTORY_H_
OLDNEW
« no previous file with comments | « components/sync_driver/shared_change_processor_unittest.cc ('k') | components/sync_driver/sync_api_component_factory_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698