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

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

Issue 7564037: Apps/Extensions Sync refactoring -- delete most of the old glue, implement new sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Release build warning :-/ Created 9 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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
11 class Extension;
12 struct UninstalledExtensionInfo;
13
14 namespace sync_api {
15 class BaseNode;
16 class WriteNode;
17 } // namespace sync_api
18
19 namespace sync_pb {
20 class EntitySpecifics;
21 class ExtensionSpecifics;
22 } // namespace sync_pb
23
24 namespace browser_sync {
25
26 typedef bool (*IsValidAndSyncablePredicate)(const Extension&);
27
28 typedef bool (*ShouldHandleExtensionUninstallPredicate)(
29 const UninstalledExtensionInfo&);
30
31 // ExtensionSpecificsGetter : BaseNode -> ExtensionSpecifics
32 typedef const sync_pb::ExtensionSpecifics& (*ExtensionSpecificsGetter)(
33 const sync_api::BaseNode&);
34
35 // A function that sets the appropriate member of the given BaseNode
36 // to the given ExtensionSpecifics.
37 typedef void (*ExtensionSpecificsSetter)(
38 const sync_pb::ExtensionSpecifics&, sync_api::WriteNode*);
39
40 // A function that tries to retrieve an ExtensionSpecifics from an
41 // EntitySpecifics. Returns true and fills in the second argument iff
42 // successful.
43 typedef bool (*ExtensionSpecificsEntityGetter)(
44 const sync_pb::EntitySpecifics&, sync_pb::ExtensionSpecifics*);
45
46 // Represents the properties needed for syncing data types that
47 // involve extensions (e.g., "real" extensions, apps).
48 struct ExtensionSyncTraits {
49 ExtensionSyncTraits(
50 syncable::ModelType model_type,
51 IsValidAndSyncablePredicate is_valid_and_syncable,
52 const char* root_node_tag,
53 ExtensionSpecificsGetter extension_specifics_getter,
54 ExtensionSpecificsSetter extension_specifics_setter,
55 ExtensionSpecificsEntityGetter extension_specifics_entity_getter);
56 ~ExtensionSyncTraits();
57
58 // The sync type for the data type.
59 const syncable::ModelType model_type;
60 // A checker to make sure that the downloaded extension is valid and
61 // syncable.
62 const IsValidAndSyncablePredicate is_valid_and_syncable;
63 // The tag with which the top-level data type node is marked.
64 const char* const root_node_tag;
65 // The function that retrieves a ExtensionSpecifics reference (which
66 // may be embedded in another specifics object) from a sync node.
67 const ExtensionSpecificsGetter extension_specifics_getter;
68 // The function that embeds an ExtensionSpecifics into a sync node.
69 const ExtensionSpecificsSetter extension_specifics_setter;
70 // The function that retrieves a ExtensionSpecifics (if possible)
71 // from an EntitySpecifics.
72 ExtensionSpecificsEntityGetter extension_specifics_entity_getter;
73 };
74
75 // Gets traits for extensions sync.
76 ExtensionSyncTraits GetExtensionSyncTraits();
77
78 // Gets traits for apps sync.
79 ExtensionSyncTraits GetAppSyncTraits();
80
81 } // namespace browser_sync
82
83 #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