| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/syncable/entry.h" | 5 #include "components/sync/syncable/entry.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" |
| 9 #include "components/sync/syncable/directory.h" | 11 #include "components/sync/syncable/directory.h" |
| 10 #include "components/sync/syncable/syncable_base_transaction.h" | 12 #include "components/sync/syncable/syncable_base_transaction.h" |
| 11 | 13 |
| 12 namespace syncer { | 14 namespace syncer { |
| 13 namespace syncable { | 15 namespace syncable { |
| 14 | 16 |
| 15 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) | 17 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) |
| 16 : basetrans_(trans) { | 18 : basetrans_(trans) { |
| 17 kernel_ = trans->directory()->GetEntryById(id); | 19 kernel_ = trans->directory()->GetEntryById(id); |
| 18 } | 20 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 35 | 37 |
| 36 Entry::Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag) | 38 Entry::Entry(BaseTransaction* trans, GetByServerTag, const std::string& tag) |
| 37 : basetrans_(trans) { | 39 : basetrans_(trans) { |
| 38 kernel_ = trans->directory()->GetEntryByServerTag(tag); | 40 kernel_ = trans->directory()->GetEntryByServerTag(tag); |
| 39 } | 41 } |
| 40 | 42 |
| 41 Directory* Entry::dir() const { | 43 Directory* Entry::dir() const { |
| 42 return basetrans_->directory(); | 44 return basetrans_->directory(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 base::DictionaryValue* Entry::ToValue(Cryptographer* cryptographer) const { | 47 std::unique_ptr<base::DictionaryValue> Entry::ToValue( |
| 46 base::DictionaryValue* entry_info = new base::DictionaryValue(); | 48 Cryptographer* cryptographer) const { |
| 49 auto entry_info = base::MakeUnique<base::DictionaryValue>(); |
| 47 entry_info->SetBoolean("good", good()); | 50 entry_info->SetBoolean("good", good()); |
| 48 if (good()) { | 51 if (good()) { |
| 49 entry_info->Set("kernel", kernel_->ToValue(cryptographer)); | 52 entry_info->Set("kernel", kernel_->ToValue(cryptographer)); |
| 50 entry_info->Set("modelType", ModelTypeToValue(GetModelType())); | 53 entry_info->Set("modelType", ModelTypeToValue(GetModelType())); |
| 51 entry_info->SetBoolean("existsOnClientBecauseNameIsNonEmpty", | 54 entry_info->SetBoolean("existsOnClientBecauseNameIsNonEmpty", |
| 52 ExistsOnClientBecauseNameIsNonEmpty()); | 55 ExistsOnClientBecauseNameIsNonEmpty()); |
| 53 entry_info->SetBoolean("isRoot", IsRoot()); | 56 entry_info->SetBoolean("isRoot", IsRoot()); |
| 54 } | 57 } |
| 55 return entry_info; | 58 return entry_info; |
| 56 } | 59 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return kernel_->ShouldMaintainHierarchy(); | 131 return kernel_->ShouldMaintainHierarchy(); |
| 129 } | 132 } |
| 130 | 133 |
| 131 std::ostream& operator<<(std::ostream& os, const Entry& entry) { | 134 std::ostream& operator<<(std::ostream& os, const Entry& entry) { |
| 132 os << *(entry.kernel_); | 135 os << *(entry.kernel_); |
| 133 return os; | 136 return os; |
| 134 } | 137 } |
| 135 | 138 |
| 136 } // namespace syncable | 139 } // namespace syncable |
| 137 } // namespace syncer | 140 } // namespace syncer |
| OLD | NEW |