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

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

Issue 8470005: Add OVERRIDE to chrome/browser/sync/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: includes Created 9 years, 1 month 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ 5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
13 #include "chrome/browser/sync/internal_api/base_node.h" 14 #include "chrome/browser/sync/internal_api/base_node.h"
14 #include "chrome/browser/sync/syncable/model_type.h" 15 #include "chrome/browser/sync/syncable/model_type.h"
15 16
16 namespace browser_sync { 17 namespace browser_sync {
17 class Cryptographer; 18 class Cryptographer;
18 class TestBookmarkModelAssociator; 19 class TestBookmarkModelAssociator;
19 } 20 }
20 21
21 namespace syncable { 22 namespace syncable {
22 class Entry; 23 class Entry;
(...skipping 23 matching lines...) Expand all
46 class WriteNode : public BaseNode { 47 class WriteNode : public BaseNode {
47 public: 48 public:
48 // Create a WriteNode using the given transaction. 49 // Create a WriteNode using the given transaction.
49 explicit WriteNode(WriteTransaction* transaction); 50 explicit WriteNode(WriteTransaction* transaction);
50 virtual ~WriteNode(); 51 virtual ~WriteNode();
51 52
52 // A client must use one (and only one) of the following Init variants to 53 // A client must use one (and only one) of the following Init variants to
53 // populate the node. 54 // populate the node.
54 55
55 // BaseNode implementation. 56 // BaseNode implementation.
56 virtual bool InitByIdLookup(int64 id); 57 virtual bool InitByIdLookup(int64 id) OVERRIDE;
57 virtual bool InitByClientTagLookup(syncable::ModelType model_type, 58 virtual bool InitByClientTagLookup(syncable::ModelType model_type,
58 const std::string& tag); 59 const std::string& tag) OVERRIDE;
59 60
60 // Create a new node with the specified parent and predecessor. |model_type| 61 // Create a new node with the specified parent and predecessor. |model_type|
61 // dictates the type of the item, and controls which EntitySpecifics proto 62 // dictates the type of the item, and controls which EntitySpecifics proto
62 // extension can be used with this item. Use a NULL |predecessor| 63 // extension can be used with this item. Use a NULL |predecessor|
63 // to indicate that this is to be the first child. 64 // to indicate that this is to be the first child.
64 // |predecessor| must be a child of |new_parent| or NULL. Returns false on 65 // |predecessor| must be a child of |new_parent| or NULL. Returns false on
65 // failure. 66 // failure.
66 bool InitByCreation(syncable::ModelType model_type, 67 bool InitByCreation(syncable::ModelType model_type,
67 const BaseNode& parent, 68 const BaseNode& parent,
68 const BaseNode* predecessor); 69 const BaseNode* predecessor);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 156
156 // Stores |new_specifics| into |entry|, encrypting if necessary. 157 // Stores |new_specifics| into |entry|, encrypting if necessary.
157 // Returns false if an error encrypting occurred (does not modify |entry|). 158 // Returns false if an error encrypting occurred (does not modify |entry|).
158 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). 159 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS).
159 static bool UpdateEntryWithEncryption( 160 static bool UpdateEntryWithEncryption(
160 browser_sync::Cryptographer* cryptographer, 161 browser_sync::Cryptographer* cryptographer,
161 const sync_pb::EntitySpecifics& new_specifics, 162 const sync_pb::EntitySpecifics& new_specifics,
162 syncable::MutableEntry* entry); 163 syncable::MutableEntry* entry);
163 164
164 // Implementation of BaseNode's abstract virtual accessors. 165 // Implementation of BaseNode's abstract virtual accessors.
165 virtual const syncable::Entry* GetEntry() const; 166 virtual const syncable::Entry* GetEntry() const OVERRIDE;
166 167
167 virtual const BaseTransaction* GetTransaction() const; 168 virtual const BaseTransaction* GetTransaction() const OVERRIDE;
168 169
169 private: 170 private:
170 friend class browser_sync::TestBookmarkModelAssociator; 171 friend class browser_sync::TestBookmarkModelAssociator;
171 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); 172 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData);
172 173
173 void* operator new(size_t size); // Node is meant for stack use only. 174 void* operator new(size_t size); // Node is meant for stack use only.
174 175
175 // Helper to set model type. This will clear any specifics data. 176 // Helper to set model type. This will clear any specifics data.
176 void PutModelType(syncable::ModelType model_type); 177 void PutModelType(syncable::ModelType model_type);
177 178
178 // Helper to set the previous node. 179 // Helper to set the previous node.
179 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; 180 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT;
180 181
181 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an 182 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an
182 // upcoming commit pass. 183 // upcoming commit pass.
183 void MarkForSyncing(); 184 void MarkForSyncing();
184 185
185 // The underlying syncable object which this class wraps. 186 // The underlying syncable object which this class wraps.
186 syncable::MutableEntry* entry_; 187 syncable::MutableEntry* entry_;
187 188
188 // The sync API transaction that is the parent of this node. 189 // The sync API transaction that is the parent of this node.
189 WriteTransaction* transaction_; 190 WriteTransaction* transaction_;
190 191
191 DISALLOW_COPY_AND_ASSIGN(WriteNode); 192 DISALLOW_COPY_AND_ASSIGN(WriteNode);
192 }; 193 };
193 194
194 } // namespace sync_api 195 } // namespace sync_api
195 196
196 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ 197 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698