// Copyright 2019 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. // Use the chrome.login API to launch and exit user sessions. [platforms=("chromeos"), implemented_in="chrome/browser/chromeos/extensions/login_screen/login/login_api.h"] namespace login { callback VoidCallback = void (); callback StringCallback = void (DOMString result); interface Functions { // Launches a managed guest session if one is set up via the admin console. // If there are several managed guest sessions set up, it will launch the // first available one. // |password|: If provided, the launched managed guest session will be // lockable, and can only be unlocked by calling // unlockManagedGuestSession() with the same password. // |callback|: Note: If the function succeeds, the callback is not // guaranteed to be called as the extension will be disabled when the // session starts. Use this callback only to handle the failure case by // checking $(ref:runtime.lastError). static void launchManagedGuestSession(optional DOMString password, optional VoidCallback callback); // Exits the current session. // |dataForNextLoginAttempt|: If set, stores data which can be read by // fetchDataForNextLoginAttempt() from the login screen. If // unset, any currently stored data will be cleared. static void exitCurrentSession(optional DOMString dataForNextLoginAttempt, optional VoidCallback callback); // Reads the dataForNextLoginAttempt set by // exitCurrentSession(). Clears the previously stored data // after reading so it can only be read once. // |callback|: Called with the stored data, or an empty string if there was // no previously stored data. static void fetchDataForNextLoginAttempt(StringCallback callback); // Locks the current managed guest session. The session has to have been // launched by launchManagedGuestSession() with a password. static void lockManagedGuestSession(optional VoidCallback callback); // Unlocks a managed guest session which was launched by // launchManagedGuestSession() with a password. The session // will unlock if the provided password matches the one provided earlier. // |password|: The password which will be used to unlock the session. // |callback|: Note: If the function succeeds, the callback is not // guaranteed to be called as the extension will be disabled when the // session starts. Use this callback only to handle the failure case by // checking $(ref:runtime.lastError). static void unlockManagedGuestSession(DOMString password, optional VoidCallback callback); }; };