Chromium Code Reviews| Index: ash/public/interfaces/session_controller.mojom |
| diff --git a/ash/public/interfaces/session_controller.mojom b/ash/public/interfaces/session_controller.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..89377d80532e06481adce761c196e15a4cf5d2f4 |
| --- /dev/null |
| +++ b/ash/public/interfaces/session_controller.mojom |
| @@ -0,0 +1,87 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +module ash.mojom; |
| + |
| +import "skia/public/interfaces/bitmap.mojom"; |
| + |
| +// Matches session_manager::SessionState |
|
James Cook
2016/12/01 23:01:43
super nit: end with . (and below) for consistency
xiyuan
2016/12/06 00:46:34
Done.
|
| +[Extensible] |
| +enum SessionState { |
| + UNKNOWN, |
|
James Cook
2016/12/01 23:01:43
nit: Please copy the comments for these enum value
xiyuan
2016/12/06 00:46:34
Done.
|
| + OOBE, |
| + LOGIN_PRIMARY, |
| + LOGGED_IN_NOT_ACTIVE, |
| + ACTIVE, |
| + LOCKED, |
| + LOGIN_SECONDARY, |
| +}; |
| + |
| +// Matches user_manager::UserType. |
| +[Extensible] |
| +enum UserType { |
| + REGULAR, |
| + GUEST, |
| + PUBLIC_ACCOUNT, |
| + SUPERVISED, |
| + KIOSK, |
| + CHILD, |
| + ARC_KIOSK, |
| +}; |
| + |
| +// Info about a user session in ash. |
| +struct UserSession { |
| + UserType type; |
| + string account_id; // Serialized AccountId |
| + string display_name; |
| + string display_email; |
| + skia.mojom.Bitmap avatar; |
| +}; |
| + |
| +// Matches ash::AddUserSessionPolicy |
| +[Extensible] |
| +enum AddUserSessionPolicy { |
| + ALLOWED, |
| + ERROR_NOT_ALLOWED_PRIMARY_USER, |
| + ERROR_NO_ELIGIBLE_USERS, |
| + ERROR_MAXIMUM_USERS_REACHED, |
| +}; |
| + |
| +// Interface for ash client (e.g. Chrome) to set session info for ash. |
| +interface SessionController { |
| + // Sets the client interface. |
| + SetClient(SessionControllerClient client); |
| + |
| + // Sets the maximum possible number of logged in users. |
| + SetMaxUsers(uint32 max_users); |
| + |
| + // Sets whether the screen can be locked. |
| + SetCanLockScreen(bool can_lock); |
| + |
| + // Sets whether the screen should be locked automatically before suspending. |
| + SetShouldLockScreenAutomatically(bool should_lock); |
| + |
| + // Sets whether adding a user to session is allowed. |
| + SetAddUserSessionPolicy(AddUserSessionPolicy add_user_session_policy); |
| + |
| + // Sets the current state of the ash session. |
| + SetSessionState(SessionState session_state); |
|
James Cook
2016/12/01 23:01:43
If all of the above functions are going to be call
xiyuan
2016/12/06 00:46:34
Makes sense. I was thinking keeping them separate
|
| + |
| + // Sets the list of user sessions. This list is taken as LRU sorted with |
| + // the first being the currently active user session. |
| + SetUserSessions(array<UserSession> user_sessions); |
|
James Cook
2016/12/01 23:01:43
Is this going to be re-sent every time the order o
xiyuan
2016/12/06 00:46:34
Good point. I overlooked this.
Split SetUserSessi
|
| +}; |
| + |
| +// Interface for ash to request session service from its client (e.g. Chrome). |
| +interface SessionControllerClient { |
| + // Requests to lock screen. |
| + RequestLockScreen(); |
| + |
| + // Switch to the active user with |account_id| |
| + // (if the user has already signed in). |
|
James Cook
2016/12/01 23:01:43
nit: wrap with line above
xiyuan
2016/12/06 00:46:34
Done.
|
| + SwitchActiveUser(string account_id); |
| + |
| + // Switch the active user to the next or previous user. |
| + CycleActiveUser(bool next_user); |
| +}; |