| OLD | NEW |
| 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_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace syncer { | 25 namespace syncer { |
| 26 | 26 |
| 27 class CommitContributor; | 27 class CommitContributor; |
| 28 class DataTypeDebugInfoEmitter; | 28 class DataTypeDebugInfoEmitter; |
| 29 class DirectoryCommitContributor; | 29 class DirectoryCommitContributor; |
| 30 class DirectoryUpdateHandler; | 30 class DirectoryUpdateHandler; |
| 31 class ModelTypeWorker; | 31 class ModelTypeWorker; |
| 32 class UpdateHandler; | 32 class UpdateHandler; |
| 33 | 33 |
| 34 typedef std::map<ModelType, UpdateHandler*> UpdateHandlerMap; | 34 using UpdateHandlerMap = std::map<ModelType, UpdateHandler*>; |
| 35 typedef std::map<ModelType, CommitContributor*> CommitContributorMap; | 35 using CommitContributorMap = std::map<ModelType, CommitContributor*>; |
| 36 | 36 |
| 37 // Keeps track of the sets of active update handlers and commit contributors. | 37 // Keeps track of the sets of active update handlers and commit contributors. |
| 38 class ModelTypeRegistry : public ModelTypeConnector, | 38 class ModelTypeRegistry : public ModelTypeConnector, |
| 39 public SyncEncryptionHandler::Observer { | 39 public SyncEncryptionHandler::Observer { |
| 40 public: | 40 public: |
| 41 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker>>& workers, | 41 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker>>& workers, |
| 42 UserShare* user_share, | 42 UserShare* user_share, |
| 43 NudgeHandler* nudge_handler, | 43 NudgeHandler* nudge_handler, |
| 44 const UssMigrator& uss_migrator); | 44 const UssMigrator& uss_migrator); |
| 45 ~ModelTypeRegistry() override; | 45 ~ModelTypeRegistry() override; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void RegisterDirectoryTypeDebugInfoObserver(TypeDebugInfoObserver* observer); | 99 void RegisterDirectoryTypeDebugInfoObserver(TypeDebugInfoObserver* observer); |
| 100 void UnregisterDirectoryTypeDebugInfoObserver( | 100 void UnregisterDirectoryTypeDebugInfoObserver( |
| 101 TypeDebugInfoObserver* observer); | 101 TypeDebugInfoObserver* observer); |
| 102 bool HasDirectoryTypeDebugInfoObserver( | 102 bool HasDirectoryTypeDebugInfoObserver( |
| 103 const TypeDebugInfoObserver* observer) const; | 103 const TypeDebugInfoObserver* observer) const; |
| 104 void RequestEmitDebugInfo(); | 104 void RequestEmitDebugInfo(); |
| 105 | 105 |
| 106 base::WeakPtr<ModelTypeConnector> AsWeakPtr(); | 106 base::WeakPtr<ModelTypeConnector> AsWeakPtr(); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 typedef std::map<ModelType, std::unique_ptr<DataTypeDebugInfoEmitter>> | 109 using DataTypeDebugInfoEmitterMap = |
| 110 DataTypeDebugInfoEmitterMap; | 110 std::map<ModelType, std::unique_ptr<DataTypeDebugInfoEmitter>>; |
| 111 | 111 |
| 112 void OnEncryptionStateChanged(); | 112 void OnEncryptionStateChanged(); |
| 113 | 113 |
| 114 // DebugInfoEmitters are never deleted. Returns an existing one if we have it. | 114 // DebugInfoEmitters are never deleted. Returns an existing one if we have it. |
| 115 DataTypeDebugInfoEmitter* GetEmitter(ModelType type); | 115 DataTypeDebugInfoEmitter* GetEmitter(ModelType type); |
| 116 | 116 |
| 117 ModelTypeSet GetEnabledNonBlockingTypes() const; | 117 ModelTypeSet GetEnabledNonBlockingTypes() const; |
| 118 ModelTypeSet GetEnabledDirectoryTypes() const; | 118 ModelTypeSet GetEnabledDirectoryTypes() const; |
| 119 | 119 |
| 120 syncable::Directory* directory() const { | 120 syncable::Directory* directory() const { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 165 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
| 166 | 166 |
| 167 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; | 167 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; |
| 168 | 168 |
| 169 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 169 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace syncer | 172 } // namespace syncer |
| 173 | 173 |
| 174 #endif // COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ | 174 #endif // COMPONENTS_SYNC_ENGINE_IMPL_MODEL_TYPE_REGISTRY_H_ |
| OLD | NEW |