| 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/string_split.h" | 7 #include "base/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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 NOTREACHED() << "No known extension for model type."; | 86 NOTREACHED() << "No known extension for model type."; |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 ModelType GetModelTypeFromSpecificsFieldNumber(int field_number) { | 90 ModelType GetModelTypeFromSpecificsFieldNumber(int field_number) { |
| 91 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 91 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
| 92 ModelType model_type = ModelTypeFromInt(i); | 92 ModelType model_type = ModelTypeFromInt(i); |
| 93 if (GetSpecificsFieldNumberFromModelType(model_type) == field_number) | 93 if (GetSpecificsFieldNumberFromModelType(model_type) == field_number) |
| 94 return model_type; | 94 return model_type; |
| 95 } | 95 } |
| 96 NOTREACHED(); | |
| 97 return UNSPECIFIED; | 96 return UNSPECIFIED; |
| 98 } | 97 } |
| 99 | 98 |
| 100 int GetSpecificsFieldNumberFromModelType(ModelType model_type) { | 99 int GetSpecificsFieldNumberFromModelType(ModelType model_type) { |
| 101 switch (model_type) { | 100 switch (model_type) { |
| 102 case BOOKMARKS: | 101 case BOOKMARKS: |
| 103 return sync_pb::EntitySpecifics::kBookmarkFieldNumber; | 102 return sync_pb::EntitySpecifics::kBookmarkFieldNumber; |
| 104 break; | 103 break; |
| 105 case PASSWORDS: | 104 case PASSWORDS: |
| 106 return sync_pb::EntitySpecifics::kPasswordFieldNumber; | 105 return sync_pb::EntitySpecifics::kPasswordFieldNumber; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 632 } |
| 634 *model_type = UNSPECIFIED; | 633 *model_type = UNSPECIFIED; |
| 635 return false; | 634 return false; |
| 636 } | 635 } |
| 637 | 636 |
| 638 bool IsRealDataType(ModelType model_type) { | 637 bool IsRealDataType(ModelType model_type) { |
| 639 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; | 638 return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; |
| 640 } | 639 } |
| 641 | 640 |
| 642 } // namespace syncer | 641 } // namespace syncer |
| OLD | NEW |