| 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 #ifndef COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/values.h" |
| 15 #include "components/sync/syncable/entry_kernel.h" | 17 #include "components/sync/syncable/entry_kernel.h" |
| 16 | 18 |
| 17 namespace syncer { | 19 namespace syncer { |
| 18 | 20 |
| 19 class Cryptographer; | 21 class Cryptographer; |
| 20 class ReadNode; | 22 class ReadNode; |
| 21 | 23 |
| 22 namespace syncable { | 24 namespace syncable { |
| 23 | 25 |
| 24 class Directory; | 26 class Directory; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 251 |
| 250 // Returns true if this is an entry that is expected to maintain hierarchy. | 252 // Returns true if this is an entry that is expected to maintain hierarchy. |
| 251 // ie. Whether or not the PARENT_ID field contains useful information. | 253 // ie. Whether or not the PARENT_ID field contains useful information. |
| 252 bool ShouldMaintainHierarchy() const; | 254 bool ShouldMaintainHierarchy() const; |
| 253 | 255 |
| 254 Directory* dir() const; | 256 Directory* dir() const; |
| 255 | 257 |
| 256 const EntryKernel GetKernelCopy() const { return *kernel_; } | 258 const EntryKernel GetKernelCopy() const { return *kernel_; } |
| 257 | 259 |
| 258 // Dumps all entry info into a DictionaryValue and returns it. | 260 // Dumps all entry info into a DictionaryValue and returns it. |
| 259 // Transfers ownership of the DictionaryValue to the caller. | 261 std::unique_ptr<base::DictionaryValue> ToValue( |
| 260 base::DictionaryValue* ToValue(Cryptographer* cryptographer) const; | 262 Cryptographer* cryptographer) const; |
| 261 | 263 |
| 262 protected: // Don't allow creation on heap, except by sync API wrappers. | 264 protected: // Don't allow creation on heap, except by sync API wrappers. |
| 263 void* operator new(size_t size) { return (::operator new)(size); } | 265 void* operator new(size_t size) { return (::operator new)(size); } |
| 264 | 266 |
| 265 inline explicit Entry(BaseTransaction* trans) | 267 inline explicit Entry(BaseTransaction* trans) |
| 266 : basetrans_(trans), kernel_(nullptr) {} | 268 : basetrans_(trans), kernel_(nullptr) {} |
| 267 | 269 |
| 268 protected: | 270 protected: |
| 269 BaseTransaction* const basetrans_; | 271 BaseTransaction* const basetrans_; |
| 270 | 272 |
| 271 EntryKernel* kernel_; | 273 EntryKernel* kernel_; |
| 272 | 274 |
| 273 private: | 275 private: |
| 274 friend class syncer::syncable::Directory; | 276 friend class syncer::syncable::Directory; |
| 275 friend class syncer::ReadNode; | 277 friend class syncer::ReadNode; |
| 276 friend std::ostream& operator<<(std::ostream& s, const Entry& e); | 278 friend std::ostream& operator<<(std::ostream& s, const Entry& e); |
| 277 | 279 |
| 278 DISALLOW_COPY_AND_ASSIGN(Entry); | 280 DISALLOW_COPY_AND_ASSIGN(Entry); |
| 279 }; | 281 }; |
| 280 | 282 |
| 281 std::ostream& operator<<(std::ostream& os, const Entry& entry); | 283 std::ostream& operator<<(std::ostream& os, const Entry& entry); |
| 282 | 284 |
| 283 } // namespace syncable | 285 } // namespace syncable |
| 284 } // namespace syncer | 286 } // namespace syncer |
| 285 | 287 |
| 286 #endif // COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ | 288 #endif // COMPONENTS_SYNC_SYNCABLE_ENTRY_H_ |
| OLD | NEW |