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

Unified Diff: ash/public/interfaces/session_controller.mojom

Issue 2545723003: ash: Add SessionController/Client mojo interfaces (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
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..88931448d73bb9a80d5308feab24301aa92c3817
--- /dev/null
+++ b/ash/public/interfaces/session_controller.mojom
@@ -0,0 +1,138 @@
+// 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.
+[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.
+enum SessionState {
+ // Default value, when session state hasn't been initialized yet.
+ UNKNOWN,
+
+ // Running out of box UI.
+ OOBE,
+
+ // Running login UI (primary user) but user sign in hasn't completed yet.
+ LOGIN_PRIMARY,
+
+ // Running login UI (primary or secondary user), user sign in has been
+ // completed but login UI hasn't been hidden yet. This means that either
+ // some session initialization is happening or user has to go through some
+ // UI flow on the same login UI like select avatar, agree to terms of
+ // service etc.
+ LOGGED_IN_NOT_ACTIVE,
+
+ // A user(s) has logged in *and* login UI is hidden i.e. user session is
+ // not blocked.
+ ACTIVE,
+
+ // The session screen is locked.
+ LOCKED,
+
+ // Same as SESSION_STATE_LOGIN_PRIMARY but for multi-profiles sign in i.e.
+ // when there's at least one user already active in the session.
+ LOGIN_SECONDARY,
+};
+
+// Matches user_manager::UserType.
+[Extensible]
+enum UserType {
+ // Regular user, has a user name and password.
+ REGULAR,
+
+ // Guest user, logs in without authentication.
+ GUEST,
+
+ // Public account user, logs in without authentication. Available only if
+ // enabled through policy.
+ PUBLIC_ACCOUNT,
+
+ // Supervised user, logs in only with local authentication.
+ SUPERVISED,
+
+ // Kiosk app robot, logs in without authentication.
+ KIOSK,
+
+ // Child user, with supervised options.
+ CHILD,
+
+ // Android app in kiosk mode, logs in without authentication.
+ ARC_KIOSK,
+};
+
+// Info about a user session in ash.
+struct UserSession {
+ 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
+ UserType type;
+ string account_id; // Serialized AccountId
+ string display_name;
+ string display_email;
+ skia.mojom.Bitmap avatar;
+};
+
+// Matches ash::AddUserSessionPolicy.
+[Extensible]
+enum AddUserSessionPolicy {
+ // Adding a user session is allowed.
+ ALLOWED,
+
+ // Disallowed due to primary user's policy.
+ ERROR_NOT_ALLOWED_PRIMARY_USER,
+
+ // Disallowed due to no eligible users.
+ ERROR_NO_ELIGIBLE_USERS,
+
+ // Disallowed due to reaching maximum supported user.
+ ERROR_MAXIMUM_USERS_REACHED,
+};
+
+// Info about an ash session.
+struct SessionInfo {
+ // Maximum possible number of logged in users in ash.
+ uint32 max_users;
+
+ // Whether the screen can be locked.
+ bool can_lock_screen;
+
+ // Whether the screen should be locked automatically before suspending.
+ bool should_lock_screen_automatically;
+
+ // Sets whether adding a user session to ash is allowed.
+ AddUserSessionPolicy add_user_session_policy;
+
+ // Current state of the ash session.
+ SessionState state;
+};
+
+// Interface for ash client (e.g. Chrome) to set session info for ash.
+interface SessionController {
+ // Sets the client interface.
+ SetClient(SessionControllerClient client);
+
+ // Sets the ash session info.
+ SetSessionInfo(SessionInfo info);
+
+ // Updates a user session. This is called when a user session is added or
+ // 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.
+ UpdateUserSession(UserSession user_session);
+
+ // Sets the order of user sessions. The order is keyed by the session id
+ // and is LRU sorted with the first being the currently active user session.
+ 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.
+};
+
+// 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).
+ SwitchActiveUser(string account_id);
+
+ // Switch the active user to the next or previous user.
+ CycleActiveUser(bool next_user);
+};

Powered by Google App Engine
This is Rietveld 408576698