Chromium Code Reviews| 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 "components/sync/base/model_type.h" | 5 #include "components/sync/base/model_type.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 static_assert(arraysize(kModelTypeInfoMap) == MODEL_TYPE_COUNT, | 148 static_assert(arraysize(kModelTypeInfoMap) == MODEL_TYPE_COUNT, |
| 149 "kModelTypeInfoMap should have MODEL_TYPE_COUNT elements"); | 149 "kModelTypeInfoMap should have MODEL_TYPE_COUNT elements"); |
| 150 | 150 |
| 151 // Notes: | 151 // Notes: |
| 152 // 1) This list must contain exactly the same elements as the set returned by | 152 // 1) This list must contain exactly the same elements as the set returned by |
| 153 // UserSelectableTypes(). | 153 // UserSelectableTypes(). |
| 154 // 2) This list must be in the same order as the respective values in the | 154 // 2) This list must be in the same order as the respective values in the |
| 155 // ModelType enum. | 155 // ModelType enum. |
| 156 const char* kUserSelectableDataTypeNames[] = { | 156 const char* kUserSelectableDataTypeNames[] = { |
|
pavely
2016/12/05 18:48:42
Please add reading list name in this list as well.
gambard
2016/12/06 10:15:42
Thanks, I have added it here but I am not sure I n
| |
| 157 "bookmarks", "preferences", "passwords", "autofill", "themes", | 157 "bookmarks", "preferences", "passwords", "autofill", "themes", |
| 158 "typedUrls", "extensions", "apps", "tabs", | 158 "typedUrls", "extensions", "apps", "tabs", |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 static_assert( | 161 static_assert( |
| 162 39 == MODEL_TYPE_COUNT, | 162 39 == MODEL_TYPE_COUNT, |
| 163 "update kUserSelectableDataTypeName to match UserSelectableTypes"); | 163 "update kUserSelectableDataTypeName to match UserSelectableTypes"); |
| 164 | 164 |
| 165 void AddDefaultFieldValue(ModelType datatype, | 165 void AddDefaultFieldValue(ModelType datatype, |
| 166 sync_pb::EntitySpecifics* specifics) { | 166 sync_pb::EntitySpecifics* specifics) { |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 // Although the order doesn't technically matter here, it's clearer to keep | 469 // Although the order doesn't technically matter here, it's clearer to keep |
| 470 // these in the same order as their definition in the ModelType enum. | 470 // these in the same order as their definition in the ModelType enum. |
| 471 set.Put(BOOKMARKS); | 471 set.Put(BOOKMARKS); |
| 472 set.Put(PREFERENCES); | 472 set.Put(PREFERENCES); |
| 473 set.Put(PASSWORDS); | 473 set.Put(PASSWORDS); |
| 474 set.Put(AUTOFILL); | 474 set.Put(AUTOFILL); |
| 475 set.Put(THEMES); | 475 set.Put(THEMES); |
| 476 set.Put(TYPED_URLS); | 476 set.Put(TYPED_URLS); |
| 477 set.Put(EXTENSIONS); | 477 set.Put(EXTENSIONS); |
| 478 set.Put(APPS); | 478 set.Put(APPS); |
| 479 set.Put(READING_LIST); | |
| 479 set.Put(PROXY_TABS); | 480 set.Put(PROXY_TABS); |
| 480 return set; | 481 return set; |
| 481 } | 482 } |
| 482 | 483 |
| 483 bool IsUserSelectableType(ModelType model_type) { | 484 bool IsUserSelectableType(ModelType model_type) { |
| 484 return UserSelectableTypes().Has(model_type); | 485 return UserSelectableTypes().Has(model_type); |
| 485 } | 486 } |
| 486 | 487 |
| 487 ModelTypeNameMap GetUserSelectableTypeNameMap() { | 488 ModelTypeNameMap GetUserSelectableTypeNameMap() { |
| 488 ModelTypeNameMap type_names; | 489 ModelTypeNameMap type_names; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 bool TypeSupportsHierarchy(ModelType model_type) { | 766 bool TypeSupportsHierarchy(ModelType model_type) { |
| 766 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER? | 767 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER? |
| 767 return model_type == BOOKMARKS; | 768 return model_type == BOOKMARKS; |
| 768 } | 769 } |
| 769 | 770 |
| 770 bool TypeSupportsOrdering(ModelType model_type) { | 771 bool TypeSupportsOrdering(ModelType model_type) { |
| 771 return model_type == BOOKMARKS; | 772 return model_type == BOOKMARKS; |
| 772 } | 773 } |
| 773 | 774 |
| 774 } // namespace syncer | 775 } // namespace syncer |
| OLD | NEW |