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

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

Issue 2724163002: ash: Use enum for SessionController::CycleActiveUser (Closed)
Patch Set: 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_ 5 #ifndef ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_
6 #define ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_ 6 #define ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_
7 7
8 #include "ash/public/cpp/session_types.h" 8 #include "ash/public/cpp/session_types.h"
9 #include "ash/public/interfaces/session_controller.mojom.h" 9 #include "ash/public/interfaces/session_controller.mojom.h"
10 #include "components/session_manager/session_manager_types.h" 10 #include "components/session_manager/session_manager_types.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return true; 158 return true;
159 case ash::mojom::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED: 159 case ash::mojom::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED:
160 *out = ash::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED; 160 *out = ash::AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED;
161 return true; 161 return true;
162 } 162 }
163 NOTREACHED(); 163 NOTREACHED();
164 return false; 164 return false;
165 } 165 }
166 }; 166 };
167 167
168 template <>
169 struct EnumTraits<ash::mojom::CycleUser, ash::CycleUser> {
170 static ash::mojom::CycleUser ToMojom(ash::CycleUser input) {
171 switch (input) {
172 case ash::CycleUser::CYCLE_TO_NEXT_USER:
173 return ash::mojom::CycleUser::CYCLE_TO_NEXT_USER;
174 case ash::CycleUser::CYCLE_TO_PREVIOUS_USER:
175 return ash::mojom::CycleUser::CYCLE_TO_PREVIOUS_USER;
176 }
177 NOTREACHED();
178 return ash::mojom::CycleUser::CYCLE_TO_NEXT_USER;
179 }
180
181 static bool FromMojom(ash::mojom::CycleUser input, ash::CycleUser* out) {
182 switch (input) {
183 case ash::mojom::CycleUser::CYCLE_TO_NEXT_USER:
184 *out = ash::CycleUser::CYCLE_TO_NEXT_USER;
185 return true;
186 case ash::mojom::CycleUser::CYCLE_TO_PREVIOUS_USER:
187 *out = ash::CycleUser::CYCLE_TO_PREVIOUS_USER;
188 return true;
189 }
190 NOTREACHED();
191 return false;
192 }
193 };
194
168 } // namespace mojo 195 } // namespace mojo
169 196
170 #endif // ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_ 197 #endif // ASH_PUBLIC_INTERFACES_SESSION_CONTROLLER_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698