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/syncable/entry_kernel.h" | 5 #include "sync/syncable/entry_kernel.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "sync/protocol/proto_value_conversions.h" | 8 #include "sync/protocol/proto_value_conversions.h" |
9 #include "sync/syncable/syncable_enum_conversions.h" | 9 #include "sync/syncable/syncable_enum_conversions.h" |
10 #include "sync/util/cryptographer.h" | 10 #include "sync/util/cryptographer.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 bool EntryKernel::ShouldMaintainPosition() const { | 52 bool EntryKernel::ShouldMaintainPosition() const { |
53 // We maintain positions for all bookmarks, except those that are | 53 // We maintain positions for all bookmarks, except those that are |
54 // server-created top-level folders. | 54 // server-created top-level folders. |
55 return (GetModelTypeFromSpecifics(ref(SPECIFICS)) == syncer::BOOKMARKS) | 55 return (GetModelTypeFromSpecifics(ref(SPECIFICS)) == syncer::BOOKMARKS) |
56 && !(!ref(UNIQUE_SERVER_TAG).empty() && ref(IS_DIR)); | 56 && !(!ref(UNIQUE_SERVER_TAG).empty() && ref(IS_DIR)); |
57 } | 57 } |
58 | 58 |
59 bool EntryKernel::ShouldMaintainHierarchy() const { | 59 bool EntryKernel::ShouldMaintainHierarchy() const { |
60 // We maintain hierarchy for bookmarks, device info, and top-level folders, | 60 // We maintain hierarchy for bookmarks and top-level folders, |
61 // but no other types. Note that the Nigori node consists of a single | 61 // but no other types. Note that the Nigori node consists of a single |
62 // top-level folder, so it's included in this set. | 62 // top-level folder, so it's included in this set. |
63 return (GetModelTypeFromSpecifics(ref(SPECIFICS)) == syncer::BOOKMARKS) | 63 return (GetModelTypeFromSpecifics(ref(SPECIFICS)) == syncer::BOOKMARKS) |
64 || (!ref(UNIQUE_SERVER_TAG).empty()); | 64 || (!ref(UNIQUE_SERVER_TAG).empty()); |
65 } | 65 } |
66 | 66 |
67 namespace { | 67 namespace { |
68 | 68 |
69 // Utility function to loop through a set of enum values and add the | 69 // Utility function to loop through a set of enum values and add the |
70 // field keys/values in the kernel to the given dictionary. | 70 // field keys/values in the kernel to the given dictionary. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 base::DictionaryValue* EntryKernelMutationToValue( | 228 base::DictionaryValue* EntryKernelMutationToValue( |
229 const EntryKernelMutation& mutation) { | 229 const EntryKernelMutation& mutation) { |
230 base::DictionaryValue* dict = new base::DictionaryValue(); | 230 base::DictionaryValue* dict = new base::DictionaryValue(); |
231 dict->Set("original", mutation.original.ToValue(NULL)); | 231 dict->Set("original", mutation.original.ToValue(NULL)); |
232 dict->Set("mutated", mutation.mutated.ToValue(NULL)); | 232 dict->Set("mutated", mutation.mutated.ToValue(NULL)); |
233 return dict; | 233 return dict; |
234 } | 234 } |
235 | 235 |
236 } // namespace syncer | 236 } // namespace syncer |
237 } // namespace syncable | 237 } // namespace syncable |
OLD | NEW |