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 [Extensible] | |
|
James Cook
2016/12/06 18:08:25
Per offline conversation I don't think these shoul
xiyuan
2016/12/06 19:24:21
Done.
| |
| 11 enum SessionState { | |
| 12 // Default value, when session state hasn't been initialized yet. | |
| 13 UNKNOWN, | |
| 14 | |
| 15 // Running out of box UI. | |
| 16 OOBE, | |
| 17 | |
| 18 // Running login UI (primary user) but user sign in hasn't completed yet. | |
| 19 LOGIN_PRIMARY, | |
| 20 | |
| 21 // Running login UI (primary or secondary user), user sign in has been | |
| 22 // completed but login UI hasn't been hidden yet. This means that either | |
| 23 // some session initialization is happening or user has to go through some | |
| 24 // UI flow on the same login UI like select avatar, agree to terms of | |
| 25 // service etc. | |
| 26 LOGGED_IN_NOT_ACTIVE, | |
| 27 | |
| 28 // A user(s) has logged in *and* login UI is hidden i.e. user session is | |
| 29 // not blocked. | |
| 30 ACTIVE, | |
| 31 | |
| 32 // The session screen is locked. | |
| 33 LOCKED, | |
| 34 | |
| 35 // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e. | |
| 36 // when there's at least one user already active in the session. | |
| 37 LOGIN_SECONDARY, | |
| 38 }; | |
| 39 | |
| 40 // Matches user_manager::UserType. | |
| 41 [Extensible] | |
| 42 enum UserType { | |
| 43 // Regular user, has a user name and password. | |
| 44 REGULAR, | |
| 45 | |
| 46 // Guest user, logs in without authentication. | |
| 47 GUEST, | |
| 48 | |
| 49 // Public account user, logs in without authentication. Available only if | |
| 50 // enabled through policy. | |
| 51 PUBLIC_ACCOUNT, | |
| 52 | |
| 53 // Supervised user, logs in only with local authentication. | |
| 54 SUPERVISED, | |
| 55 | |
| 56 // Kiosk app robot, logs in without authentication. | |
| 57 KIOSK, | |
| 58 | |
| 59 // Child user, with supervised options. | |
| 60 CHILD, | |
| 61 | |
| 62 // Android app in kiosk mode, logs in without authentication. | |
| 63 ARC_KIOSK, | |
| 64 }; | |
| 65 | |
| 66 // Info about a user session in ash. | |
| 67 struct UserSession { | |
| 68 uint32 session_id; | |
|
James Cook
2016/12/06 18:08:25
Is this a general id used throughout chrome, or ju
xiyuan
2016/12/06 19:24:21
The concept of the user session id does not exist
| |
| 69 UserType type; | |
| 70 string account_id; // Serialized AccountId | |
| 71 string display_name; | |
| 72 string display_email; | |
| 73 skia.mojom.Bitmap avatar; | |
| 74 }; | |
| 75 | |
| 76 // Matches ash::AddUserSessionPolicy. | |
| 77 [Extensible] | |
| 78 enum AddUserSessionPolicy { | |
| 79 // Adding a user session is allowed. | |
| 80 ALLOWED, | |
| 81 | |
| 82 // Disallowed due to primary user's policy. | |
| 83 ERROR_NOT_ALLOWED_PRIMARY_USER, | |
| 84 | |
| 85 // Disallowed due to no eligible users. | |
| 86 ERROR_NO_ELIGIBLE_USERS, | |
| 87 | |
| 88 // Disallowed due to reaching maximum supported user. | |
| 89 ERROR_MAXIMUM_USERS_REACHED, | |
| 90 }; | |
| 91 | |
| 92 // Info about an ash session. | |
| 93 struct SessionInfo { | |
| 94 // Maximum possible number of logged in users in ash. | |
| 95 uint32 max_users; | |
| 96 | |
| 97 // Whether the screen can be locked. | |
| 98 bool can_lock_screen; | |
| 99 | |
| 100 // Whether the screen should be locked automatically before suspending. | |
| 101 bool should_lock_screen_automatically; | |
| 102 | |
| 103 // Sets whether adding a user session to ash is allowed. | |
| 104 AddUserSessionPolicy add_user_session_policy; | |
| 105 | |
| 106 // Current state of the ash session. | |
| 107 SessionState state; | |
| 108 }; | |
| 109 | |
| 110 // Interface for ash client (e.g. Chrome) to set session info for ash. | |
| 111 interface SessionController { | |
| 112 // Sets the client interface. | |
| 113 SetClient(SessionControllerClient client); | |
| 114 | |
| 115 // Sets the ash session info. | |
| 116 SetSessionInfo(SessionInfo info); | |
| 117 | |
| 118 // Updates a user session. This is called when a user session is added or | |
| 119 // its meta data (e.g. name, avatar) is changed. | |
|
James Cook
2016/12/06 18:08:25
nit: Comment that there is no method to remove a u
xiyuan
2016/12/06 19:24:21
Done.
| |
| 120 UpdateUserSession(UserSession user_session); | |
| 121 | |
| 122 // Sets the order of user sessions. The order is keyed by the session id | |
| 123 // and is LRU sorted with the first being the currently active user session. | |
| 124 SetUserSessionOrder(array<uint32> user_session_order); | |
|
James Cook
2016/12/06 18:08:25
I like this approach.
nit: maybe make the paramet
xiyuan
2016/12/06 19:24:21
Done.
| |
| 125 }; | |
| 126 | |
| 127 // Interface for ash to request session service from its client (e.g. Chrome). | |
| 128 interface SessionControllerClient { | |
| 129 // Requests to lock screen. | |
| 130 RequestLockScreen(); | |
| 131 | |
| 132 // Switch to the active user with |account_id| (if the user has already signed | |
| 133 // in). | |
| 134 SwitchActiveUser(string account_id); | |
| 135 | |
| 136 // Switch the active user to the next or previous user. | |
| 137 CycleActiveUser(bool next_user); | |
| 138 }; | |
| OLD | NEW |