Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / sync / sessions / model_type_registry.h
blob126d05b834ae7dd7ebc99248065a779e34d2be2b
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
3 // found in the LICENSE file.
5 #ifndef SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_
6 #define SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/stl_util.h"
13 #include "sync/base/sync_export.h"
14 #include "sync/internal_api/public/base/model_type.h"
15 #include "sync/internal_api/public/engine/model_safe_worker.h"
17 namespace syncer {
19 namespace syncable {
20 class Directory;
21 } // namespace syncable
23 class SyncDirectoryUpdateHandler;
24 class SyncDirectoryCommitContributor;
26 typedef std::map<ModelType, SyncDirectoryUpdateHandler*> UpdateHandlerMap;
27 typedef std::map<ModelType, SyncDirectoryCommitContributor*>
28 CommitContributorMap;
30 // Keeps track of the sets of active update handlers and commit contributors.
31 class SYNC_EXPORT_PRIVATE ModelTypeRegistry {
32 public:
33 ModelTypeRegistry(
34 const std::vector<scoped_refptr<ModelSafeWorker> >& workers,
35 syncable::Directory* directory);
36 ~ModelTypeRegistry();
38 // Sets the set of enabled types.
39 void SetEnabledDirectoryTypes(const ModelSafeRoutingInfo& routing_info);
41 // Simple getters.
42 UpdateHandlerMap* update_handler_map();
43 CommitContributorMap* commit_contributor_map();
45 private:
46 // Classes to manage the types hooked up to receive and commit sync data.
47 UpdateHandlerMap update_handler_map_;
48 CommitContributorMap commit_contributor_map_;
50 // Deleter for the |update_handler_map_|.
51 STLValueDeleter<UpdateHandlerMap> update_handler_deleter_;
53 // Deleter for the |commit_contributor_map_|.
54 STLValueDeleter<CommitContributorMap> commit_contributor_deleter_;
56 // The known ModelSafeWorkers.
57 std::map<ModelSafeGroup, scoped_refptr<ModelSafeWorker> > workers_map_;
59 // The directory. Not owned.
60 syncable::Directory* directory_;
62 DISALLOW_COPY_AND_ASSIGN(ModelTypeRegistry);
65 } // namespace syncer
67 #endif // SYNC_ENGINE_MODEL_TYPE_REGISTRY_H_