OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "services/preferences/public/cpp/tracked_preference_validation_delegate
_struct_traits.h" |
| 6 |
| 7 namespace mojo { |
| 8 |
| 9 using MojomValueState = |
| 10 prefs::mojom::TrackedPreferenceValidationDelegate_ValueState; |
| 11 |
| 12 MojomValueState |
| 13 EnumTraits<MojomValueState, ::PrefHashStoreTransaction::ValueState>::ToMojom( |
| 14 PrefHashStoreTransaction::ValueState input) { |
| 15 switch (input) { |
| 16 case PrefHashStoreTransaction::UNCHANGED: |
| 17 return MojomValueState::UNCHANGED; |
| 18 case PrefHashStoreTransaction::CLEARED: |
| 19 return MojomValueState::CLEARED; |
| 20 case PrefHashStoreTransaction::SECURE_LEGACY: |
| 21 return MojomValueState::SECURE_LEGACY; |
| 22 case PrefHashStoreTransaction::CHANGED: |
| 23 return MojomValueState::CHANGED; |
| 24 case PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE: |
| 25 return MojomValueState::UNTRUSTED_UNKNOWN_VALUE; |
| 26 case PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE: |
| 27 return MojomValueState::TRUSTED_UNKNOWN_VALUE; |
| 28 case PrefHashStoreTransaction::TRUSTED_NULL_VALUE: |
| 29 return MojomValueState::TRUSTED_NULL_VALUE; |
| 30 case PrefHashStoreTransaction::UNSUPPORTED: |
| 31 return MojomValueState::UNSUPPORTED; |
| 32 } |
| 33 NOTREACHED(); |
| 34 return {}; |
| 35 } |
| 36 |
| 37 bool EnumTraits<MojomValueState, ::PrefHashStoreTransaction::ValueState>:: |
| 38 FromMojom(MojomValueState input, |
| 39 PrefHashStoreTransaction::ValueState* output) { |
| 40 switch (input) { |
| 41 case MojomValueState::UNCHANGED: |
| 42 *output = PrefHashStoreTransaction::UNCHANGED; |
| 43 return true; |
| 44 case MojomValueState::CLEARED: |
| 45 *output = PrefHashStoreTransaction::CLEARED; |
| 46 return true; |
| 47 case MojomValueState::SECURE_LEGACY: |
| 48 *output = PrefHashStoreTransaction::SECURE_LEGACY; |
| 49 return true; |
| 50 case MojomValueState::CHANGED: |
| 51 *output = PrefHashStoreTransaction::CHANGED; |
| 52 return true; |
| 53 case MojomValueState::UNTRUSTED_UNKNOWN_VALUE: |
| 54 *output = PrefHashStoreTransaction::UNTRUSTED_UNKNOWN_VALUE; |
| 55 return true; |
| 56 case MojomValueState::TRUSTED_UNKNOWN_VALUE: |
| 57 *output = PrefHashStoreTransaction::TRUSTED_UNKNOWN_VALUE; |
| 58 return true; |
| 59 case MojomValueState::TRUSTED_NULL_VALUE: |
| 60 *output = PrefHashStoreTransaction::TRUSTED_NULL_VALUE; |
| 61 return true; |
| 62 case MojomValueState::UNSUPPORTED: |
| 63 *output = PrefHashStoreTransaction::UNSUPPORTED; |
| 64 return true; |
| 65 } |
| 66 return false; |
| 67 } |
| 68 |
| 69 } // namespace mojo |
OLD | NEW |