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/internal_api/public/base/model_type.h" | 5 #include "sync/internal_api/public/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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 type_str = working_copy.substr(0, end); | 645 type_str = working_copy.substr(0, end); |
646 } | 646 } |
647 syncer::ModelType type = ModelTypeFromString(type_str); | 647 syncer::ModelType type = ModelTypeFromString(type_str); |
648 if (IsRealDataType(type)) | 648 if (IsRealDataType(type)) |
649 model_types.Put(type); | 649 model_types.Put(type); |
650 working_copy = working_copy.substr(end + 1); | 650 working_copy = working_copy.substr(end + 1); |
651 } | 651 } |
652 return model_types; | 652 return model_types; |
653 } | 653 } |
654 | 654 |
655 scoped_ptr<base::ListValue> ModelTypeSetToValue(ModelTypeSet model_types) { | 655 std::unique_ptr<base::ListValue> ModelTypeSetToValue(ModelTypeSet model_types) { |
656 scoped_ptr<base::ListValue> value(new base::ListValue()); | 656 std::unique_ptr<base::ListValue> value(new base::ListValue()); |
657 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { | 657 for (ModelTypeSet::Iterator it = model_types.First(); it.Good(); it.Inc()) { |
658 value->AppendString(ModelTypeToString(it.Get())); | 658 value->AppendString(ModelTypeToString(it.Get())); |
659 } | 659 } |
660 return value; | 660 return value; |
661 } | 661 } |
662 | 662 |
663 ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value) { | 663 ModelTypeSet ModelTypeSetFromValue(const base::ListValue& value) { |
664 ModelTypeSet result; | 664 ModelTypeSet result; |
665 for (base::ListValue::const_iterator i = value.begin(); | 665 for (base::ListValue::const_iterator i = value.begin(); |
666 i != value.end(); ++i) { | 666 i != value.end(); ++i) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 bool TypeSupportsHierarchy(ModelType model_type) { | 732 bool TypeSupportsHierarchy(ModelType model_type) { |
733 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER? | 733 // TODO(stanisc): crbug/438313: Should this also include TOP_LEVEL_FOLDER? |
734 return model_type == BOOKMARKS; | 734 return model_type == BOOKMARKS; |
735 } | 735 } |
736 | 736 |
737 bool TypeSupportsOrdering(ModelType model_type) { | 737 bool TypeSupportsOrdering(ModelType model_type) { |
738 return model_type == BOOKMARKS; | 738 return model_type == BOOKMARKS; |
739 } | 739 } |
740 | 740 |
741 } // namespace syncer | 741 } // namespace syncer |
OLD | NEW |