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

Side by Side Diff: chrome/browser/sync/glue/extension_sync_traits.h

Issue 3110008: Massive refactoring of extensions sync code (Closed) Base URL: 76.121.192.83:~/projects/chromium/src
Patch Set: Fixed compile error Created 10 years, 4 months 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
(Empty)
1 // Copyright (c) 2010 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.
4
5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_
6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_
7 #pragma once
8
9 #include "chrome/browser/sync/syncable/model_type.h"
10 #include "chrome/browser/sync/glue/extension_util.h"
11
12 namespace sync_api {
13 class BaseNode;
14 class WriteNode;
15 } // namespace sync_api
16
17 namespace sync_pb {
18 class ExtensionSpecifics;
19 } // namespace sync_pb
20
21 namespace browser_sync {
22
23 // ExtensionSpecificsGetter : BaseNode -> ExtensionSpecifics
24 typedef const sync_pb::ExtensionSpecifics& (*ExtensionSpecificsGetter)(
25 const sync_api::BaseNode&);
26
27 // A function that sets the appropriate member of the given BaseNode
28 // to the given ExtensionSpecifics.
29 typedef void (*ExtensionSpecificsSetter)(
30 const sync_pb::ExtensionSpecifics&, sync_api::WriteNode*);
31
32 // A function that tries to retrieve an ExtensionSpecifics from an
33 // EntitySpecifics. Returns true and fills in the second argument iff
34 // successful.
35 typedef bool (*ExtensionSpecificsEntityGetter)(
36 const sync_pb::EntitySpecifics&, sync_pb::ExtensionSpecifics*);
37
38 // Represents the properties needed for syncing data types that
39 // involve extensions (e.g., "real" extensions, apps).
40 struct ExtensionSyncTraits {
41 ExtensionSyncTraits(
42 syncable::ModelType model_type,
43 const char* root_node_tag,
44 const ExtensionTypeSet& allowed_extension_types,
45 ExtensionSpecificsGetter extension_specifics_getter,
46 ExtensionSpecificsSetter extension_specifics_setter,
47 ExtensionSpecificsEntityGetter extension_specifics_entity_getter);
48
49 // The sync type for the data type.
50 const syncable::ModelType model_type;
51 // The tag with which the top-level data type node is marked.
52 const char* const root_node_tag;
53 // The set of allowed ExtensionTypes (not just a single one since
54 // some data types handle more than one).
55 const ExtensionTypeSet allowed_extension_types;
56 // The function that retrieves a ExtensionSpecifics reference (which
57 // may be embedded in another specifics object) from a sync node.
58 const ExtensionSpecificsGetter extension_specifics_getter;
59 // The function that embeds an ExtensionSpecifics into a sync node.
60 const ExtensionSpecificsSetter extension_specifics_setter;
61 // The function that retrieves a ExtensionSpecifics (if possible)
62 // from an EntitySpecifics.
63 ExtensionSpecificsEntityGetter extension_specifics_entity_getter;
64 };
65
66 // Gets traits for extensions sync.
67 ExtensionSyncTraits GetExtensionSyncTraits();
68
69 // TODO(akalin): Write GetAppSyncTraits(), too.
70
71 } // namespace browser_sync
72
73 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/extension_sync.cc ('k') | chrome/browser/sync/glue/extension_sync_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698