| 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 "sync/syncable/entry.h" | 5 #include "sync/syncable/entry.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) | 21 Entry::Entry(BaseTransaction* trans, GetById, const Id& id) |
| 22 : basetrans_(trans) { | 22 : basetrans_(trans) { |
| 23 kernel_ = trans->directory()->GetEntryById(id); | 23 kernel_ = trans->directory()->GetEntryById(id); |
| 24 } | 24 } |
| 25 | 25 |
| 26 Entry::Entry(BaseTransaction* trans, GetByClientTag, const string& tag) | 26 Entry::Entry(BaseTransaction* trans, GetByClientTag, const string& tag) |
| 27 : basetrans_(trans) { | 27 : basetrans_(trans) { |
| 28 kernel_ = trans->directory()->GetEntryByClientTag(tag); | 28 kernel_ = trans->directory()->GetEntryByClientTag(tag); |
| 29 } | 29 } |
| 30 | 30 |
| 31 Entry::Entry(BaseTransaction* trans, GetByServerTag, const string& tag) | 31 Entry::Entry(BaseTransaction* trans, GetTypeRoot, ModelType type) |
| 32 : basetrans_(trans) { | 32 : basetrans_(trans) { |
| 33 const std::string& tag = ModelTypeToRootTag(type); |
| 33 kernel_ = trans->directory()->GetEntryByServerTag(tag); | 34 kernel_ = trans->directory()->GetEntryByServerTag(tag); |
| 34 } | 35 } |
| 35 | 36 |
| 36 Entry::Entry(BaseTransaction* trans, GetByHandle, int64 metahandle) | 37 Entry::Entry(BaseTransaction* trans, GetByHandle, int64 metahandle) |
| 37 : basetrans_(trans) { | 38 : basetrans_(trans) { |
| 38 kernel_ = trans->directory()->GetEntryByHandle(metahandle); | 39 kernel_ = trans->directory()->GetEntryByHandle(metahandle); |
| 39 } | 40 } |
| 40 | 41 |
| 42 Entry::Entry(BaseTransaction* trans, GetByServerTag, const string& tag) |
| 43 : basetrans_(trans) { |
| 44 kernel_ = trans->directory()->GetEntryByServerTag(tag); |
| 45 } |
| 46 |
| 41 Directory* Entry::dir() const { | 47 Directory* Entry::dir() const { |
| 42 return basetrans_->directory(); | 48 return basetrans_->directory(); |
| 43 } | 49 } |
| 44 | 50 |
| 45 base::DictionaryValue* Entry::ToValue(Cryptographer* cryptographer) const { | 51 base::DictionaryValue* Entry::ToValue(Cryptographer* cryptographer) const { |
| 46 base::DictionaryValue* entry_info = new base::DictionaryValue(); | 52 base::DictionaryValue* entry_info = new base::DictionaryValue(); |
| 47 entry_info->SetBoolean("good", good()); | 53 entry_info->SetBoolean("good", good()); |
| 48 if (good()) { | 54 if (good()) { |
| 49 entry_info->Set("kernel", kernel_->ToValue(cryptographer)); | 55 entry_info->Set("kernel", kernel_->ToValue(cryptographer)); |
| 50 entry_info->Set("modelType", | 56 entry_info->Set("modelType", |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 os << "TempFlags: "; | 173 os << "TempFlags: "; |
| 168 for ( ; i < BIT_TEMPS_END; ++i) { | 174 for ( ; i < BIT_TEMPS_END; ++i) { |
| 169 if (kernel->ref(static_cast<BitTemp>(i))) | 175 if (kernel->ref(static_cast<BitTemp>(i))) |
| 170 os << "#" << i - BIT_TEMPS_BEGIN << ", "; | 176 os << "#" << i - BIT_TEMPS_BEGIN << ", "; |
| 171 } | 177 } |
| 172 return os; | 178 return os; |
| 173 } | 179 } |
| 174 | 180 |
| 175 } // namespace syncable | 181 } // namespace syncable |
| 176 } // namespace syncer | 182 } // namespace syncer |
| OLD | NEW |