OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ | 5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ |
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ | 6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "components/prefs/persistent_pref_store.h" | 8 #include "components/prefs/persistent_pref_store.h" |
9 #include "components/prefs/pref_value_store.h" | 9 #include "components/prefs/pref_value_store.h" |
10 #include "mojo/public/cpp/bindings/enum_traits.h" | 10 #include "mojo/public/cpp/bindings/enum_traits.h" |
11 #include "services/preferences/public/interfaces/preferences.mojom-shared.h" | 11 #include "services/preferences/public/interfaces/preferences.mojom-shared.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 | 14 |
15 template <> | 15 template <> |
16 struct EnumTraits<::prefs::mojom::PrefStoreType, | 16 struct EnumTraits<::prefs::mojom::PrefStoreType, |
17 ::PrefValueStore::PrefStoreType> { | 17 ::PrefValueStore::PrefStoreType> { |
18 static prefs::mojom::PrefStoreType ToMojom( | 18 static prefs::mojom::PrefStoreType ToMojom( |
19 PrefValueStore::PrefStoreType input); | 19 PrefValueStore::PrefStoreType input); |
20 | 20 |
21 static bool FromMojom(prefs::mojom::PrefStoreType input, | 21 static bool FromMojom(prefs::mojom::PrefStoreType input, |
22 PrefValueStore::PrefStoreType* output); | 22 PrefValueStore::PrefStoreType* output); |
23 }; | 23 }; |
24 | 24 |
25 template <> | 25 template <> |
26 struct EnumTraits<::prefs::mojom::PersistentPrefStoreConnector_ReadError, | 26 struct EnumTraits<::prefs::mojom::PersistentPrefStoreConnection_ReadError, |
27 ::PersistentPrefStore::PrefReadError> { | 27 ::PersistentPrefStore::PrefReadError> { |
28 static prefs::mojom::PersistentPrefStoreConnector_ReadError ToMojom( | 28 static prefs::mojom::PersistentPrefStoreConnection_ReadError ToMojom( |
29 PersistentPrefStore::PrefReadError input); | 29 PersistentPrefStore::PrefReadError input); |
30 | 30 |
31 static bool FromMojom( | 31 static bool FromMojom( |
32 prefs::mojom::PersistentPrefStoreConnector_ReadError input, | 32 prefs::mojom::PersistentPrefStoreConnection_ReadError input, |
33 PersistentPrefStore::PrefReadError* output); | 33 PersistentPrefStore::PrefReadError* output); |
34 }; | 34 }; |
35 | 35 |
36 } // namespace mojo | 36 } // namespace mojo |
37 | 37 |
38 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ | 38 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREFERENCES_STRUCT_TRAITS_H_ |
OLD | NEW |