OLD | NEW |
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 #include "chrome/browser/sync/internal_api/base_node.h" | 5 #include "chrome/browser/sync/internal_api/base_node.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 ServerNameToSyncAPIName(GetEntry()->Get(syncable::NON_UNIQUE_NAME), | 194 ServerNameToSyncAPIName(GetEntry()->Get(syncable::NON_UNIQUE_NAME), |
195 &result); | 195 &result); |
196 } | 196 } |
197 return result; | 197 return result; |
198 } | 198 } |
199 | 199 |
200 GURL BaseNode::GetURL() const { | 200 GURL BaseNode::GetURL() const { |
201 return GURL(GetBookmarkSpecifics().url()); | 201 return GURL(GetBookmarkSpecifics().url()); |
202 } | 202 } |
203 | 203 |
| 204 bool BaseNode::HasChildren() const { |
| 205 syncable::Directory* dir = GetTransaction()->GetLookup(); |
| 206 syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); |
| 207 return dir->HasChildren(trans, GetEntry()->Get(syncable::ID)); |
| 208 } |
| 209 |
204 int64 BaseNode::GetPredecessorId() const { | 210 int64 BaseNode::GetPredecessorId() const { |
205 syncable::Id id_string = GetEntry()->Get(syncable::PREV_ID); | 211 syncable::Id id_string = GetEntry()->Get(syncable::PREV_ID); |
206 if (id_string.IsRoot()) | 212 if (id_string.IsRoot()) |
207 return kInvalidId; | 213 return kInvalidId; |
208 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); | 214 return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); |
209 } | 215 } |
210 | 216 |
211 int64 BaseNode::GetSuccessorId() const { | 217 int64 BaseNode::GetSuccessorId() const { |
212 syncable::Id id_string = GetEntry()->Get(syncable::NEXT_ID); | 218 syncable::Id id_string = GetEntry()->Get(syncable::NEXT_ID); |
213 if (id_string.IsRoot()) | 219 if (id_string.IsRoot()) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 const sync_pb::EntitySpecifics& specifics) { | 335 const sync_pb::EntitySpecifics& specifics) { |
330 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(specifics); | 336 syncable::ModelType type = syncable::GetModelTypeFromSpecifics(specifics); |
331 DCHECK_NE(syncable::UNSPECIFIED, type); | 337 DCHECK_NE(syncable::UNSPECIFIED, type); |
332 if (GetModelType() != syncable::UNSPECIFIED) { | 338 if (GetModelType() != syncable::UNSPECIFIED) { |
333 DCHECK_EQ(GetModelType(), type); | 339 DCHECK_EQ(GetModelType(), type); |
334 } | 340 } |
335 unencrypted_data_.CopyFrom(specifics); | 341 unencrypted_data_.CopyFrom(specifics); |
336 } | 342 } |
337 | 343 |
338 } // namespace sync_api | 344 } // namespace sync_api |
OLD | NEW |