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

Side by Side Diff: chrome/browser/sync/internal_api/read_node.h

Issue 7633077: Refactor syncapi.h (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: This patch has compiled from a clean build 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_INTERNAL_API_READ_NODE_H_
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_READ_NODE_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "chrome/browser/sync/internal_api/base_node.h"
13 #include "chrome/browser/sync/syncable/model_type.h"
14
15 namespace sync_pb {
16 class AppSpecifics;
17 class AutofillSpecifics;
18 class AutofillProfileSpecifics;
19 class BookmarkSpecifics;
20 class EntitySpecifics;
21 class ExtensionSpecifics;
22 class SessionSpecifics;
23 class NigoriSpecifics;
24 class PreferenceSpecifics;
25 class PasswordSpecificsData;
26 class ThemeSpecifics;
27 class TypedUrlSpecifics;
28 }
29
30 namespace sync_api {
31
32 // ReadNode wraps a syncable::Entry to provide the functionality of a
33 // read-only BaseNode.
34 class ReadNode : public BaseNode {
35 public:
36 // Create an unpopulated ReadNode on the given transaction. Call some flavor
37 // of Init to populate the ReadNode with a database entry.
38 explicit ReadNode(const BaseTransaction* transaction);
39 virtual ~ReadNode();
40
41 // A client must use one (and only one) of the following Init variants to
42 // populate the node.
43
44 // BaseNode implementation.
45 virtual bool InitByIdLookup(int64 id);
46 virtual bool InitByClientTagLookup(syncable::ModelType model_type,
47 const std::string& tag);
48
49 // There is always a root node, so this can't fail. The root node is
50 // never mutable, so root lookup is only possible on a ReadNode.
51 void InitByRootLookup();
52
53 // Each server-created permanent node is tagged with a unique string.
54 // Look up the node with the particular tag. If it does not exist,
55 // return false.
56 bool InitByTagLookup(const std::string& tag);
57
58 // Implementation of BaseNode's abstract virtual accessors.
59 virtual const syncable::Entry* GetEntry() const;
60 virtual const BaseTransaction* GetTransaction() const;
61
62 protected:
63 ReadNode();
64
65 private:
66 void* operator new(size_t size); // Node is meant for stack use only.
67
68 // The underlying syncable object which this class wraps.
69 syncable::Entry* entry_;
70
71 // The sync API transaction that is the parent of this node.
72 const BaseTransaction* transaction_;
73
74 DISALLOW_COPY_AND_ASSIGN(ReadNode);
75 };
76
77 } // namespace sync_api
78
79 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_READ_NODE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/internal_api/base_transaction.cc ('k') | chrome/browser/sync/internal_api/read_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698