Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: services/preferences/public/cpp/preferences_struct_traits.cc

Issue 2635153002: Pref service: expose all read-only PrefStores through Mojo (Closed)
Patch Set: Address bauerb's review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/preferences_struct_traits.h"
6
7 namespace mojo {
8
9 using PrefStoreType = prefs::mojom::PrefStoreType;
10
11 PrefStoreType EnumTraits<PrefStoreType, PrefValueStore::PrefStoreType>::ToMojom(
12 PrefValueStore::PrefStoreType input) {
13 switch (input) {
14 case PrefValueStore::INVALID_STORE:
15 break;
16 case PrefValueStore::MANAGED_STORE:
17 return PrefStoreType::MANAGED;
18 case PrefValueStore::SUPERVISED_USER_STORE:
19 return PrefStoreType::SUPERVISED_USER;
20 case PrefValueStore::EXTENSION_STORE:
21 return PrefStoreType::EXTENSION;
22 case PrefValueStore::COMMAND_LINE_STORE:
23 return PrefStoreType::COMMAND_LINE;
24 case PrefValueStore::USER_STORE:
25 return PrefStoreType::USER;
26 case PrefValueStore::RECOMMENDED_STORE:
27 return PrefStoreType::RECOMMENDED;
28 case PrefValueStore::DEFAULT_STORE:
29 return PrefStoreType::DEFAULT;
30 }
31 NOTREACHED();
32 return {};
33 }
34
35 bool EnumTraits<PrefStoreType, PrefValueStore::PrefStoreType>::FromMojom(
36 PrefStoreType input,
37 PrefValueStore::PrefStoreType* output) {
38 switch (input) {
39 case PrefStoreType::MANAGED:
40 *output = PrefValueStore::MANAGED_STORE;
41 return true;
42 case PrefStoreType::SUPERVISED_USER:
43 *output = PrefValueStore::SUPERVISED_USER_STORE;
44 return true;
45 case PrefStoreType::EXTENSION:
46 *output = PrefValueStore::EXTENSION_STORE;
47 return true;
48 case PrefStoreType::COMMAND_LINE:
49 *output = PrefValueStore::COMMAND_LINE_STORE;
50 return true;
51 case PrefStoreType::USER:
52 *output = PrefValueStore::USER_STORE;
53 return true;
54 case PrefStoreType::RECOMMENDED:
55 *output = PrefValueStore::RECOMMENDED_STORE;
56 return true;
57 case PrefStoreType::DEFAULT:
58 *output = PrefValueStore::DEFAULT_STORE;
59 return true;
60 }
61 return false;
62 }
63
64 } // namespace mojo
OLDNEW
« no previous file with comments | « services/preferences/public/cpp/preferences_struct_traits.h ('k') | services/preferences/public/cpp/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698