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 ////////////////////