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

Side by Side Diff: ash/public/interfaces/user_info_traits.h

Issue 2911493002: cros: Pull user info from session_controller_client.mojom into separate mojom. (Closed)
Patch Set: Fix ordering in typemaps Created 3 years, 7 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
« no previous file with comments | « ash/public/interfaces/user_info.typemap ('k') | ash/session/session_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef ASH_PUBLIC_INTERFACES_USER_INFO_TRAITS_H_
6 #define ASH_PUBLIC_INTERFACES_USER_INFO_TRAITS_H_
7
8 #include "ash/public/interfaces/user_info.mojom.h"
9 #include "components/user_manager/user_type.h"
10
11 namespace mojo {
12
13 template <>
14 struct EnumTraits<ash::mojom::UserType, user_manager::UserType> {
15 static ash::mojom::UserType ToMojom(user_manager::UserType input) {
16 switch (input) {
17 case user_manager::USER_TYPE_REGULAR:
18 return ash::mojom::UserType::REGULAR;
19 case user_manager::USER_TYPE_GUEST:
20 return ash::mojom::UserType::GUEST;
21 case user_manager::USER_TYPE_PUBLIC_ACCOUNT:
22 return ash::mojom::UserType::PUBLIC_ACCOUNT;
23 case user_manager::USER_TYPE_SUPERVISED:
24 return ash::mojom::UserType::SUPERVISED;
25 case user_manager::USER_TYPE_KIOSK_APP:
26 return ash::mojom::UserType::KIOSK;
27 case user_manager::USER_TYPE_CHILD:
28 return ash::mojom::UserType::CHILD;
29 case user_manager::USER_TYPE_ARC_KIOSK_APP:
30 return ash::mojom::UserType::ARC_KIOSK;
31 case user_manager::USER_TYPE_ACTIVE_DIRECTORY:
32 return ash::mojom::UserType::ACTIVE_DIRECTORY;
33 case user_manager::NUM_USER_TYPES:
34 // Bail as this is not a valid user type.
35 break;
36 }
37 NOTREACHED();
38 return ash::mojom::UserType::REGULAR;
39 }
40
41 static bool FromMojom(ash::mojom::UserType input,
42 user_manager::UserType* out) {
43 switch (input) {
44 case ash::mojom::UserType::REGULAR:
45 *out = user_manager::USER_TYPE_REGULAR;
46 return true;
47 case ash::mojom::UserType::GUEST:
48 *out = user_manager::USER_TYPE_GUEST;
49 return true;
50 case ash::mojom::UserType::PUBLIC_ACCOUNT:
51 *out = user_manager::USER_TYPE_PUBLIC_ACCOUNT;
52 return true;
53 case ash::mojom::UserType::SUPERVISED:
54 *out = user_manager::USER_TYPE_SUPERVISED;
55 return true;
56 case ash::mojom::UserType::KIOSK:
57 *out = user_manager::USER_TYPE_KIOSK_APP;
58 return true;
59 case ash::mojom::UserType::CHILD:
60 *out = user_manager::USER_TYPE_CHILD;
61 return true;
62 case ash::mojom::UserType::ARC_KIOSK:
63 *out = user_manager::USER_TYPE_ARC_KIOSK_APP;
64 return true;
65 case ash::mojom::UserType::ACTIVE_DIRECTORY:
66 *out = user_manager::USER_TYPE_ACTIVE_DIRECTORY;
67 return true;
68 }
69 NOTREACHED();
70 return false;
71 }
72 };
73
74 } // namespace mojo
75
76 #endif // ASH_PUBLIC_INTERFACES_USER_INFO_TRAITS_H_
OLDNEW
« no previous file with comments | « ash/public/interfaces/user_info.typemap ('k') | ash/session/session_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698