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 SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 5 #ifndef SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // Keeps track of the sets of active update handlers and commit contributors. | 42 // Keeps track of the sets of active update handlers and commit contributors. |
43 class SYNC_EXPORT_PRIVATE ModelTypeRegistry | 43 class SYNC_EXPORT_PRIVATE ModelTypeRegistry |
44 : public SyncContext, | 44 : public SyncContext, |
45 public SyncEncryptionHandler::Observer { | 45 public SyncEncryptionHandler::Observer { |
46 public: | 46 public: |
47 // Constructs a ModelTypeRegistry that supports directory types. | 47 // Constructs a ModelTypeRegistry that supports directory types. |
48 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker> >& workers, | 48 ModelTypeRegistry(const std::vector<scoped_refptr<ModelSafeWorker> >& workers, |
49 syncable::Directory* directory, | 49 syncable::Directory* directory, |
50 NudgeHandler* nudge_handler); | 50 NudgeHandler* nudge_handler); |
51 virtual ~ModelTypeRegistry(); | 51 ~ModelTypeRegistry() override; |
52 | 52 |
53 // Sets the set of enabled types. | 53 // Sets the set of enabled types. |
54 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); | 54 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); |
55 | 55 |
56 // Enables an off-thread type for syncing. Connects the given proxy | 56 // Enables an off-thread type for syncing. Connects the given proxy |
57 // and its task_runner to the newly created worker. | 57 // and its task_runner to the newly created worker. |
58 // | 58 // |
59 // Expects that the proxy's ModelType is not currently enabled. | 59 // Expects that the proxy's ModelType is not currently enabled. |
60 virtual void ConnectSyncTypeToWorker( | 60 void ConnectSyncTypeToWorker( |
61 syncer::ModelType type, | 61 syncer::ModelType type, |
62 const DataTypeState& data_type_state, | 62 const DataTypeState& data_type_state, |
63 const syncer::UpdateResponseDataList& saved_pending_updates, | 63 const syncer::UpdateResponseDataList& saved_pending_updates, |
64 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, | 64 const scoped_refptr<base::SequencedTaskRunner>& type_task_runner, |
65 const base::WeakPtr<ModelTypeSyncProxyImpl>& proxy) override; | 65 const base::WeakPtr<ModelTypeSyncProxyImpl>& proxy) override; |
66 | 66 |
67 // Disables the syncing of an off-thread type. | 67 // Disables the syncing of an off-thread type. |
68 // | 68 // |
69 // Expects that the type is currently enabled. | 69 // Expects that the type is currently enabled. |
70 // Deletes the worker associated with the type. | 70 // Deletes the worker associated with the type. |
71 virtual void DisconnectSyncWorker(syncer::ModelType type) override; | 71 void DisconnectSyncWorker(syncer::ModelType type) override; |
72 | 72 |
73 // Implementation of SyncEncryptionHandler::Observer. | 73 // Implementation of SyncEncryptionHandler::Observer. |
74 virtual void OnPassphraseRequired( | 74 void OnPassphraseRequired( |
75 PassphraseRequiredReason reason, | 75 PassphraseRequiredReason reason, |
76 const sync_pb::EncryptedData& pending_keys) override; | 76 const sync_pb::EncryptedData& pending_keys) override; |
77 virtual void OnPassphraseAccepted() override; | 77 void OnPassphraseAccepted() override; |
78 virtual void OnBootstrapTokenUpdated(const std::string& bootstrap_token, | 78 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, |
79 BootstrapTokenType type) override; | 79 BootstrapTokenType type) override; |
80 virtual void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, | 80 void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, |
81 bool encrypt_everything) override; | 81 bool encrypt_everything) override; |
82 virtual void OnEncryptionComplete() override; | 82 void OnEncryptionComplete() override; |
83 virtual void OnCryptographerStateChanged( | 83 void OnCryptographerStateChanged(Cryptographer* cryptographer) override; |
84 Cryptographer* cryptographer) override; | 84 void OnPassphraseTypeChanged(PassphraseType type, |
85 virtual void OnPassphraseTypeChanged(PassphraseType type, | 85 base::Time passphrase_time) override; |
86 base::Time passphrase_time) override; | |
87 | 86 |
88 // Gets the set of enabled types. | 87 // Gets the set of enabled types. |
89 ModelTypeSet GetEnabledTypes() const; | 88 ModelTypeSet GetEnabledTypes() const; |
90 | 89 |
91 // Simple getters. | 90 // Simple getters. |
92 UpdateHandlerMap* update_handler_map(); | 91 UpdateHandlerMap* update_handler_map(); |
93 CommitContributorMap* commit_contributor_map(); | 92 CommitContributorMap* commit_contributor_map(); |
94 DirectoryTypeDebugInfoEmitterMap* directory_type_debug_info_emitter_map(); | 93 DirectoryTypeDebugInfoEmitterMap* directory_type_debug_info_emitter_map(); |
95 | 94 |
96 void RegisterDirectoryTypeDebugInfoObserver( | 95 void RegisterDirectoryTypeDebugInfoObserver( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 156 ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
158 | 157 |
159 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; | 158 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; |
160 | 159 |
161 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 160 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
162 }; | 161 }; |
163 | 162 |
164 } // namespace syncer | 163 } // namespace syncer |
165 | 164 |
166 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ | 165 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_ |
OLD | NEW |