| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/engine_impl/loopback_server/persistent_permanent_entit
y.h" | 5 #include "components/sync/engine_impl/loopback_server/persistent_permanent_entit
y.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 | 9 |
| 10 using std::string; | 10 using std::string; |
| 11 | 11 |
| 12 using syncer::ModelType; | 12 using syncer::ModelType; |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // The parent tag for children of the root entity. Entities with this parent are | 15 // The parent tag for children of the root entity. Entities with this parent are |
| 16 // referred to as top level enities. | 16 // referred to as top level enities. |
| 17 static const char kRootParentTag[] = "0"; | 17 static const char kRootParentTag[] = "0"; |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 namespace syncer { | 20 namespace syncer { |
| 21 | 21 |
| 22 PersistentPermanentEntity::~PersistentPermanentEntity() {} | 22 PersistentPermanentEntity::~PersistentPermanentEntity() {} |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 std::unique_ptr<LoopbackServerEntity> PersistentPermanentEntity::CreateNew( | 25 std::unique_ptr<LoopbackServerEntity> PersistentPermanentEntity::Create( |
| 26 const ModelType& model_type, | 26 const ModelType& model_type, |
| 27 const string& server_tag, | 27 const string& server_tag, |
| 28 const string& name, | 28 const string& name, |
| 29 const string& parent_server_tag) { | 29 const string& parent_server_tag) { |
| 30 CHECK(model_type != syncer::UNSPECIFIED) << "The entity's ModelType is " | 30 CHECK(model_type != syncer::UNSPECIFIED) << "The entity's ModelType is " |
| 31 << "invalid."; | 31 << "invalid."; |
| 32 CHECK(!server_tag.empty()) | 32 CHECK(!server_tag.empty()) |
| 33 << "A PersistentPermanentEntity must have a server tag."; | 33 << "A PersistentPermanentEntity must have a server tag."; |
| 34 CHECK(!name.empty()) << "The entity must have a non-empty name."; | 34 CHECK(!name.empty()) << "The entity must have a non-empty name."; |
| 35 CHECK(!parent_server_tag.empty()) | 35 CHECK(!parent_server_tag.empty()) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool PersistentPermanentEntity::IsPermanent() const { | 112 bool PersistentPermanentEntity::IsPermanent() const { |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 | 115 |
| 116 sync_pb::LoopbackServerEntity_Type | 116 sync_pb::LoopbackServerEntity_Type |
| 117 PersistentPermanentEntity::GetLoopbackServerEntityType() const { | 117 PersistentPermanentEntity::GetLoopbackServerEntityType() const { |
| 118 return sync_pb::LoopbackServerEntity_Type_PERMANENT; | 118 return sync_pb::LoopbackServerEntity_Type_PERMANENT; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace syncer | 121 } // namespace syncer |
| OLD | NEW |