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 "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "sync/protocol/app_notification_specifics.pb.h" | 9 #include "sync/protocol/app_notification_specifics.pb.h" |
10 #include "sync/protocol/app_setting_specifics.pb.h" | 10 #include "sync/protocol/app_setting_specifics.pb.h" |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 516 |
517 base::StringValue* ModelTypeToValue(ModelType model_type) { | 517 base::StringValue* ModelTypeToValue(ModelType model_type) { |
518 if (model_type >= FIRST_REAL_MODEL_TYPE) { | 518 if (model_type >= FIRST_REAL_MODEL_TYPE) { |
519 return new base::StringValue(ModelTypeToString(model_type)); | 519 return new base::StringValue(ModelTypeToString(model_type)); |
520 } else if (model_type == TOP_LEVEL_FOLDER) { | 520 } else if (model_type == TOP_LEVEL_FOLDER) { |
521 return new base::StringValue("Top-level folder"); | 521 return new base::StringValue("Top-level folder"); |
522 } else if (model_type == UNSPECIFIED) { | 522 } else if (model_type == UNSPECIFIED) { |
523 return new base::StringValue("Unspecified"); | 523 return new base::StringValue("Unspecified"); |
524 } | 524 } |
525 NOTREACHED(); | 525 NOTREACHED(); |
526 return new base::StringValue(""); | 526 return new base::StringValue(std::string()); |
527 } | 527 } |
528 | 528 |
529 ModelType ModelTypeFromValue(const base::Value& value) { | 529 ModelType ModelTypeFromValue(const base::Value& value) { |
530 if (value.IsType(base::Value::TYPE_STRING)) { | 530 if (value.IsType(base::Value::TYPE_STRING)) { |
531 std::string result; | 531 std::string result; |
532 CHECK(value.GetAsString(&result)); | 532 CHECK(value.GetAsString(&result)); |
533 return ModelTypeFromString(result); | 533 return ModelTypeFromString(result); |
534 } else if (value.IsType(base::Value::TYPE_INTEGER)) { | 534 } else if (value.IsType(base::Value::TYPE_INTEGER)) { |
535 int result; | 535 int result; |
536 CHECK(value.GetAsInteger(&result)); | 536 CHECK(value.GetAsInteger(&result)); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 | 872 |
873 bool IsRealDataType(ModelType model_type) { | 873 bool IsRealDataType(ModelType model_type) { |
874 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; | 874 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; |
875 } | 875 } |
876 | 876 |
877 bool IsActOnceDataType(ModelType model_type) { | 877 bool IsActOnceDataType(ModelType model_type) { |
878 return model_type == HISTORY_DELETE_DIRECTIVES; | 878 return model_type == HISTORY_DELETE_DIRECTIVES; |
879 } | 879 } |
880 | 880 |
881 } // namespace syncer | 881 } // namespace syncer |
OLD | NEW |