| OLD | NEW |
| 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 "sync/internal_api/public/base_node.h" | 5 #include "sync/internal_api/public/base_node.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 | 10 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return GetEntry()->GetMtime(); | 156 return GetEntry()->GetMtime(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 bool BaseNode::GetIsFolder() const { | 159 bool BaseNode::GetIsFolder() const { |
| 160 return GetEntry()->GetIsDir(); | 160 return GetEntry()->GetIsDir(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool BaseNode::GetIsPermanentFolder() const { | 163 bool BaseNode::GetIsPermanentFolder() const { |
| 164 bool is_permanent_folder = !GetEntry()->GetUniqueServerTag().empty(); | 164 bool is_permanent_folder = !GetEntry()->GetUniqueServerTag().empty(); |
| 165 if (is_permanent_folder) { | 165 if (is_permanent_folder) { |
| 166 // If the node is a permanent folder it must also have IS_DIR bit set. | 166 // If the node is a permanent folder it must also have IS_DIR bit set, |
| 167 DCHECK(GetIsFolder()); | 167 // except some nigori nodes on old accounts. |
| 168 DCHECK(GetIsFolder() || GetModelType() == NIGORI); |
| 168 } | 169 } |
| 169 return is_permanent_folder; | 170 return is_permanent_folder; |
| 170 } | 171 } |
| 171 | 172 |
| 172 std::string BaseNode::GetTitle() const { | 173 std::string BaseNode::GetTitle() const { |
| 173 std::string result; | 174 std::string result; |
| 174 // TODO(zea): refactor bookmarks to not need this functionality. | 175 // TODO(zea): refactor bookmarks to not need this functionality. |
| 175 if (BOOKMARKS == GetModelType() && | 176 if (BOOKMARKS == GetModelType() && |
| 176 GetEntry()->GetSpecifics().has_encrypted()) { | 177 GetEntry()->GetSpecifics().has_encrypted()) { |
| 177 // Special case for legacy bookmarks dealing with encryption. | 178 // Special case for legacy bookmarks dealing with encryption. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 const sync_pb::EntitySpecifics& specifics) { | 282 const sync_pb::EntitySpecifics& specifics) { |
| 282 ModelType type = GetModelTypeFromSpecifics(specifics); | 283 ModelType type = GetModelTypeFromSpecifics(specifics); |
| 283 DCHECK_NE(UNSPECIFIED, type); | 284 DCHECK_NE(UNSPECIFIED, type); |
| 284 if (GetModelType() != UNSPECIFIED) { | 285 if (GetModelType() != UNSPECIFIED) { |
| 285 DCHECK_EQ(GetModelType(), type); | 286 DCHECK_EQ(GetModelType(), type); |
| 286 } | 287 } |
| 287 unencrypted_data_.CopyFrom(specifics); | 288 unencrypted_data_.CopyFrom(specifics); |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace syncer | 291 } // namespace syncer |
| OLD | NEW |