From 461cc6054fe5e59b676a30224beb44b8aaf801ad Mon Sep 17 00:00:00 2001 From: ankhler <47143834+ankhler@users.noreply.github.com> Date: Wed, 25 Mar 2020 01:44:14 +0100 Subject: [PATCH] Add the chrome.loginState API (#42853) * Add the chrome.loginState API https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/common/extensions/api/login_state.idl * Update index.d.ts * Update index.d.ts --- types/chrome/index.d.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index de869d11ae..1644be7c66 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -4153,6 +4153,34 @@ declare namespace chrome.input.ime { export var onReset: InputResetEvent; } +//////////////////// +// LoginState +//////////////////// +/** + * Use the chrome.loginState API to read and monitor the login state. + * Permissions: "loginState" + * @since Chrome 78. + * Important: This API works only on Chrome OS. + */ +declare namespace chrome.loginState { + export interface SessionStateChangedEvent extends chrome.events.Event<(sessionState: SessionState) => void> { } + + /** Possible profile types. */ + export type ProfileType = 'SIGNIN_PROFILE'|'USER_PROFILE'; + + /** Possible session states. */ + export type SessionState = 'UNKNOWN'|'IN_OOBE_SCREEN'|'IN_LOGIN_SCREEN'|'IN_SESSION'|'IN_LOCK_SCREEN'; + + /** Gets the type of the profile the extension is in. */ + export function getProfileType(callback: (profileType: ProfileType) => void): void; + + /** Gets the current session state. */ + export function getSessionState(callback: (sessionState: SessionState) => void): void; + + /** Dispatched when the session state changes. sessionState is the new session state.*/ + export const onSessionStateChanged: SessionStateChangedEvent; +} + //////////////////// // Management ////////////////////