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_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 5 #ifndef SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ |
6 #define SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 6 #define SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "sync/base/sync_export.h" | 16 #include "sync/base/sync_export.h" |
17 #include "sync/engine/nudge_handler.h" | 17 #include "sync/engine/nudge_handler.h" |
18 #include "sync/internal_api/public/base/model_type.h" | 18 #include "sync/internal_api/public/base/model_type.h" |
19 #include "sync/internal_api/public/engine/model_safe_worker.h" | 19 #include "sync/internal_api/public/engine/model_safe_worker.h" |
20 #include "sync/internal_api/public/non_blocking_sync_common.h" | 20 #include "sync/internal_api/public/non_blocking_sync_common.h" |
21 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" | 21 #include "sync/internal_api/public/sessions/type_debug_info_observer.h" |
22 #include "sync/internal_api/public/sync_context.h" | 22 #include "sync/internal_api/public/sync_context.h" |
23 #include "sync/internal_api/public/sync_encryption_handler.h" | 23 #include "sync/internal_api/public/sync_encryption_handler.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 NudgeHandler* nudge_handler); | 55 NudgeHandler* nudge_handler); |
56 ~ModelTypeRegistry() override; | 56 ~ModelTypeRegistry() override; |
57 | 57 |
58 // Sets the set of enabled types. | 58 // Sets the set of enabled types. |
59 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); | 59 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info); |
60 | 60 |
61 // Enables an off-thread type for syncing. Connects the given proxy | 61 // Enables an off-thread type for syncing. Connects the given proxy |
62 // and its task_runner to the newly created worker. | 62 // and its task_runner to the newly created worker. |
63 // | 63 // |
64 // Expects that the proxy's ModelType is not currently enabled. | 64 // Expects that the proxy's ModelType is not currently enabled. |
65 void ConnectSyncTypeToWorker( | 65 void ConnectSyncTypeToWorker(syncer::ModelType type, |
66 syncer::ModelType type, | 66 std::unique_ptr<syncer_v2::ActivationContext> |
67 scoped_ptr<syncer_v2::ActivationContext> activation_context) override; | 67 activation_context) override; |
68 | 68 |
69 // Disables the syncing of an off-thread type. | 69 // Disables the syncing of an off-thread type. |
70 // | 70 // |
71 // Expects that the type is currently enabled. | 71 // Expects that the type is currently enabled. |
72 // Deletes the worker associated with the type. | 72 // Deletes the worker associated with the type. |
73 void DisconnectSyncWorker(syncer::ModelType type) override; | 73 void DisconnectSyncWorker(syncer::ModelType type) override; |
74 | 74 |
75 // Implementation of SyncEncryptionHandler::Observer. | 75 // Implementation of SyncEncryptionHandler::Observer. |
76 void OnPassphraseRequired( | 76 void OnPassphraseRequired( |
77 PassphraseRequiredReason reason, | 77 PassphraseRequiredReason reason, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Does not own its contents. | 130 // Does not own its contents. |
131 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; | 131 DirectoryTypeDebugInfoEmitterMap directory_type_debug_info_emitter_map_; |
132 | 132 |
133 // The known ModelSafeWorkers. | 133 // The known ModelSafeWorkers. |
134 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_map_; | 134 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_map_; |
135 | 135 |
136 // The directory. Not owned. | 136 // The directory. Not owned. |
137 syncable::Directory* directory_; | 137 syncable::Directory* directory_; |
138 | 138 |
139 // A copy of the directory's most recent cryptographer. | 139 // A copy of the directory's most recent cryptographer. |
140 scoped_ptr<Cryptographer> cryptographer_; | 140 std::unique_ptr<Cryptographer> cryptographer_; |
141 | 141 |
142 // The set of encrypted types. | 142 // The set of encrypted types. |
143 ModelTypeSet encrypted_types_; | 143 ModelTypeSet encrypted_types_; |
144 | 144 |
145 // The NudgeHandler. Not owned. | 145 // The NudgeHandler. Not owned. |
146 NudgeHandler* nudge_handler_; | 146 NudgeHandler* nudge_handler_; |
147 | 147 |
148 // The set of enabled directory types. | 148 // The set of enabled directory types. |
149 ModelTypeSet enabled_directory_types_; | 149 ModelTypeSet enabled_directory_types_; |
150 | 150 |
151 // The set of observers of per-type debug info. | 151 // The set of observers of per-type debug info. |
152 // | 152 // |
153 // Each of the DirectoryTypeDebugInfoEmitters needs such a list. There's | 153 // Each of the DirectoryTypeDebugInfoEmitters needs such a list. There's |
154 // a lot of them, and their lifetimes are unpredictable, so it makes the | 154 // a lot of them, and their lifetimes are unpredictable, so it makes the |
155 // book-keeping easier if we just store the list here. That way it's | 155 // book-keeping easier if we just store the list here. That way it's |
156 // guaranteed to live as long as this sync backend. | 156 // guaranteed to live as long as this sync backend. |
157 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; | 157 base::ObserverList<TypeDebugInfoObserver> type_debug_info_observers_; |
158 | 158 |
159 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; | 159 base::WeakPtrFactory<ModelTypeRegistry> weak_ptr_factory_; |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); | 161 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace syncer | 164 } // namespace syncer |
165 | 165 |
166 #endif // SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ | 166 #endif // SYNC_SESSIONS_MODEL_TYPE_REGISTRY_H_ |
OLD | NEW |