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

Side by Side Diff: components/sync/core/base_node.cc

Issue 2376123003: [Sync] Move //components/sync to the syncer namespace. (Closed)
Patch Set: Fix tools and iOS. Created 4 years, 2 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "components/sync/core/base_node.h" 5 #include "components/sync/core/base_node.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <stack> 9 #include <stack>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "components/sync/protocol/typed_url_specifics.pb.h" 24 #include "components/sync/protocol/typed_url_specifics.pb.h"
25 #include "components/sync/syncable/directory.h" 25 #include "components/sync/syncable/directory.h"
26 #include "components/sync/syncable/entry.h" 26 #include "components/sync/syncable/entry.h"
27 #include "components/sync/syncable/syncable_base_transaction.h" 27 #include "components/sync/syncable/syncable_base_transaction.h"
28 #include "components/sync/syncable/syncable_id.h" 28 #include "components/sync/syncable/syncable_id.h"
29 29
30 using sync_pb::AutofillProfileSpecifics; 30 using sync_pb::AutofillProfileSpecifics;
31 31
32 namespace syncer { 32 namespace syncer {
33 33
34 using syncable::SPECIFICS; 34 using syncer::syncable::SPECIFICS;
35 35
36 // Helper function to look up the int64_t metahandle of an object given the ID 36 // Helper function to look up the int64_t metahandle of an object given the ID
37 // string. 37 // string.
38 static int64_t IdToMetahandle(syncable::BaseTransaction* trans, 38 static int64_t IdToMetahandle(syncable::BaseTransaction* trans,
39 const syncable::Id& id) { 39 const syncable::Id& id) {
40 if (id.IsNull()) 40 if (id.IsNull())
41 return kInvalidId; 41 return kInvalidId;
42 syncable::Entry entry(trans, syncable::GET_BY_ID, id); 42 syncable::Entry entry(trans, syncable::GET_BY_ID, id);
43 if (!entry.good()) 43 if (!entry.good())
44 return kInvalidId; 44 return kInvalidId;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const { 259 const sync_pb::EntitySpecifics& BaseNode::GetEntitySpecifics() const {
260 return GetUnencryptedSpecifics(GetEntry()); 260 return GetUnencryptedSpecifics(GetEntry());
261 } 261 }
262 262
263 ModelType BaseNode::GetModelType() const { 263 ModelType BaseNode::GetModelType() const {
264 return GetEntry()->GetModelType(); 264 return GetEntry()->GetModelType();
265 } 265 }
266 266
267 const syncer::AttachmentIdList BaseNode::GetAttachmentIds() const { 267 const AttachmentIdList BaseNode::GetAttachmentIds() const {
268 AttachmentIdList result; 268 AttachmentIdList result;
269 const sync_pb::AttachmentMetadata& metadata = 269 const sync_pb::AttachmentMetadata& metadata =
270 GetEntry()->GetAttachmentMetadata(); 270 GetEntry()->GetAttachmentMetadata();
271 for (int i = 0; i < metadata.record_size(); ++i) { 271 for (int i = 0; i < metadata.record_size(); ++i) {
272 result.push_back(AttachmentId::CreateFromProto(metadata.record(i).id())); 272 result.push_back(AttachmentId::CreateFromProto(metadata.record(i).id()));
273 } 273 }
274 return result; 274 return result;
275 } 275 }
276 276
277 void BaseNode::SetUnencryptedSpecifics( 277 void BaseNode::SetUnencryptedSpecifics(
278 const sync_pb::EntitySpecifics& specifics) { 278 const sync_pb::EntitySpecifics& specifics) {
279 ModelType type = GetModelTypeFromSpecifics(specifics); 279 ModelType type = GetModelTypeFromSpecifics(specifics);
280 DCHECK_NE(UNSPECIFIED, type); 280 DCHECK_NE(UNSPECIFIED, type);
281 if (GetModelType() != UNSPECIFIED) { 281 if (GetModelType() != UNSPECIFIED) {
282 DCHECK_EQ(GetModelType(), type); 282 DCHECK_EQ(GetModelType(), type);
283 } 283 }
284 unencrypted_data_.CopyFrom(specifics); 284 unencrypted_data_.CopyFrom(specifics);
285 } 285 }
286 286
287 } // namespace syncer 287 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698