Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module ash.mojom; | |
| 6 | |
| 7 import "skia/public/interfaces/bitmap.mojom"; | |
| 8 | |
| 9 // Matches session_manager::SessionState. | |
| 10 enum SessionState { | |
| 11 // Default value, when session state hasn't been initialized yet. | |
| 12 UNKNOWN, | |
| 13 | |
| 14 // Running out of box UI. | |
| 15 OOBE, | |
| 16 | |
| 17 // Running login UI (primary user) but user sign in hasn't completed yet. | |
| 18 LOGIN_PRIMARY, | |
| 19 | |
| 20 // Running login UI (primary or secondary user), user sign in has been | |
| 21 // completed but login UI hasn't been hidden yet. This means that either | |
| 22 // some session initialization is happening or user has to go through some | |
| 23 // UI flow on the same login UI like select avatar, agree to terms of | |
| 24 // service etc. | |
| 25 LOGGED_IN_NOT_ACTIVE, | |
| 26 | |
| 27 // A user(s) has logged in *and* login UI is hidden i.e. user session is | |
| 28 // not blocked. | |
| 29 ACTIVE, | |
| 30 | |
| 31 // The session screen is locked. | |
| 32 LOCKED, | |
| 33 | |
| 34 // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e. | |
| 35 // when there's at least one user already active in the session. | |
| 36 LOGIN_SECONDARY, | |
| 37 }; | |
| 38 | |
| 39 // Matches user_manager::UserType. | |
| 40 enum UserType { | |
| 41 // Regular user, has a user name and password. | |
| 42 REGULAR, | |
| 43 | |
| 44 // Guest user, logs in without authentication. | |
| 45 GUEST, | |
| 46 | |
| 47 // Public account user, logs in without authentication. Available only if | |
| 48 // enabled through policy. | |
| 49 PUBLIC_ACCOUNT, | |
| 50 | |
| 51 // Supervised user, logs in only with local authentication. | |
| 52 SUPERVISED, | |
| 53 | |
| 54 // Kiosk app robot, logs in without authentication. | |
| 55 KIOSK, | |
| 56 | |
| 57 // Child user, with supervised options. | |
| 58 CHILD, | |
| 59 | |
| 60 // Android app in kiosk mode, logs in without authentication. | |
| 61 ARC_KIOSK, | |
| 62 }; | |
| 63 | |
| 64 // Info about a user session in ash. | |
| 65 struct UserSession { | |
| 66 // A user session id for the user session. It is generated by session manager | |
| 67 // (chrome) when a user session starts and never changes during the lifetime | |
| 68 // of the session manager. The number starts at 1 for the first user session | |
| 69 // and incremented by one for each subsequent user session. | |
| 70 uint32 session_id; | |
|
Tom Sepez
2016/12/08 19:05:23
Do we hand this out to less trustworthy clients th
xiyuan
2016/12/08 19:26:20
The info is passed from session manager code (chro
| |
| 71 | |
| 72 UserType type; | |
| 73 string serialized_account_id; // TODO(xiyuan): Use typemapping for AccountId. | |
|
Tom Sepez
2016/12/08 19:05:23
same question here.
xiyuan
2016/12/08 19:26:20
This is part of the user info inside a user sessio
| |
| 74 string display_name; | |
| 75 string display_email; | |
| 76 skia.mojom.Bitmap avatar; | |
| 77 }; | |
| 78 | |
| 79 // Matches ash::AddUserSessionPolicy. | |
| 80 enum AddUserSessionPolicy { | |
| 81 // Adding a user session is allowed. | |
| 82 ALLOWED, | |
| 83 | |
| 84 // Disallowed due to primary user's policy. | |
| 85 ERROR_NOT_ALLOWED_PRIMARY_USER, | |
| 86 | |
| 87 // Disallowed due to no eligible users. | |
| 88 ERROR_NO_ELIGIBLE_USERS, | |
| 89 | |
| 90 // Disallowed due to reaching maximum supported user. | |
| 91 ERROR_MAXIMUM_USERS_REACHED, | |
| 92 }; | |
| 93 | |
| 94 // Info about an ash session. | |
| 95 struct SessionInfo { | |
| 96 // Maximum possible number of logged in users in ash. | |
| 97 uint32 max_users; | |
| 98 | |
| 99 // Whether the screen can be locked. | |
| 100 bool can_lock_screen; | |
| 101 | |
| 102 // Whether the screen should be locked automatically before suspending. | |
| 103 bool should_lock_screen_automatically; | |
| 104 | |
| 105 // Sets whether adding a user session to ash is allowed. | |
| 106 AddUserSessionPolicy add_user_session_policy; | |
| 107 | |
| 108 // Current state of the ash session. | |
| 109 SessionState state; | |
| 110 }; | |
| 111 | |
| 112 // Interface for ash client (e.g. Chrome) to set session info for ash. | |
| 113 interface SessionController { | |
| 114 // Sets the client interface. | |
| 115 SetClient(SessionControllerClient client); | |
| 116 | |
| 117 // Sets the ash session info. | |
| 118 SetSessionInfo(SessionInfo info); | |
| 119 | |
| 120 // Updates a user session. This is called when a user session is added or | |
| 121 // its meta data (e.g. name, avatar) is changed. There is no method to remove | |
| 122 // a user session because ash/chrome does not support that. All users are | |
| 123 // logged out at the same time. | |
| 124 UpdateUserSession(UserSession user_session); | |
| 125 | |
| 126 // Sets the order of user sessions. The order is keyed by the session id. | |
| 127 // Currently, session manager set a LRU order with the first one being the | |
| 128 // active user session. | |
| 129 SetUserSessionOrder(array<uint32> user_session_ids); | |
| 130 }; | |
| 131 | |
| 132 // Interface for ash to request session service from its client (e.g. Chrome). | |
| 133 interface SessionControllerClient { | |
| 134 // Requests to lock screen. | |
| 135 RequestLockScreen(); | |
| 136 | |
| 137 // Switch to the active user with |account_id| (if the user has already signed | |
| 138 // in). | |
| 139 SwitchActiveUser(string account_id); | |
| 140 | |
| 141 // Switch the active user to the next or previous user. | |
| 142 CycleActiveUser(bool next_user); | |
| 143 }; | |
| OLD | NEW |