[go: up one dir, main page]

blob: 4b8c02abf0f35e44a2b63c7cc8118ce3f11b67e9 [file] [log] [blame]
// Copyright 2017 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 "components/account_id/interfaces/account_id.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
// Allows clients (e.g. the browser process) to send messages to the ash
// login/lock/user-add screens.
// TODO(estade): this is in the process of being migrated off Mojo. Methods will
// move to ash::LoginScreen or ash::LoginScreenModel.
interface LoginScreen {
// Sets the client interface.
SetClient(LoginScreenClient client);
// Displays the lock screen. |did_show| is true iff the lock UI was
// successfully displayed.
ShowLockScreen() => (bool did_show);
// Displays the login screen. |did_show| is true iff the login UI was
// successfully displayed.
ShowLoginScreen() => (bool did_show);
// Check if the login/lock screen is ready for a password.
IsReadyForPassword() => (bool is_ready);
// Display a toast describing the latest kiosk app launch error.
ShowKioskAppError(string message);
// Sets whether users can be added from the login screen.
SetAddUserButtonEnabled(bool enable);
// Sets whether shutdown button is enabled in the login screen.
SetShutdownButtonEnabled(bool enable);
// Sets if the guest button on the login shelf can be shown. Even if set to
// true the button may still not be visible.
SetAllowLoginAsGuest(bool allow_guest);
// Transitions focus to the shelf area. If |reverse|, focuses the status area.
FocusLoginShelf(bool reverse);
};
// Allows ash lock screen to control a client (e.g. Chrome browser). Requests
// often involve preferences or talk to cryptohome that is not available to ash.
interface LoginScreenClient {
// Attempt to authenticate a user with a password or PIN.
//
// If auth succeeds:
// chrome will hide the lock screen and clear any displayed error messages.
// If auth fails:
// chrome will request lock screen to show error messages.
// |account_id|: The AccountId to authenticate against.
// |password|: The submitted password.
// |authenticated_by_pin|: True if we are using pin to authenticate.
//
// The result will be set to true if auth was successful, false if not.
//
// TODO(jdufault): Extract authenticated_by_pin into a separate mojom method,
// similar to the other Authenticate* methods
AuthenticateUserWithPasswordOrPin(
signin.mojom.AccountId account_id,
string password,
bool authenticated_by_pin) => (bool auth_success);
// Attempt to authenticate the user with with an external binary.
AuthenticateUserWithExternalBinary(signin.mojom.AccountId account_id)
=> (bool auth_success);
// Attempt to enroll a user in the external binary authentication system.
EnrollUserWithExternalBinary() => (bool enrollment_success);
// Try to authenticate |account_id| using easy unlock. This can be used on the
// login or lock screen.
// |account_id|: The account id of the user we are authenticating.
//
// TODO(jdufault): Refactor this method to return an auth_success, similar to
// the other auth methods above.
AuthenticateUserWithEasyUnlock(signin.mojom.AccountId account_id);
// Validates parent access code for the user identified by |account_id|. When
// |account_id| is empty it tries to validate the access code for any child
// that is signed in the device. Passes validation result in the callback.
// Note: This should only be used for child user, it will always return false
// when a non-child id is used.
ValidateParentAccessCode(
signin.mojom.AccountId? account_id,
string access_code) => (bool access_code_valid);
// Request to hard lock the user pod.
// |account_id|: The account id of the user in the user pod.
HardlockPod(signin.mojom.AccountId account_id);
// Focus user pod of user with |account_id|.
OnFocusPod(signin.mojom.AccountId account_id);
// Notify that no user pod is focused.
OnNoPodFocused();
// Load wallpaper of user with |account_id|.
LoadWallpaper(signin.mojom.AccountId account_id);
// Sign out current user.
SignOutUser();
// Close add user screen.
CancelAddUser();
// Launches guest mode.
LoginAsGuest();
// User with |account_id| has reached maximum incorrect password attempts.
OnMaxIncorrectPasswordAttempted(signin.mojom.AccountId account_id);
// Should pass the focus to the active lock screen app window, if there is
// one. This is called when a lock screen app is reported to be active (using
// tray_action mojo interface), and is next in the tab order.
// |HandleFocusLeavingLockScreenApps| should be called to return focus to the
// lock screen.
// |reverse|: Whether the tab order is reversed.
FocusLockScreenApps(bool reverse);
// Passes focus to the OOBE dialog if it is showing. No-op otherwise.
FocusOobeDialog();
// Show the gaia sign-in dialog. If |can_close| is true, the dialog can be
// closed. The value in |prefilled_account| will be used to prefill the
// sign-in dialog so the user does not need to type the account email.
ShowGaiaSignin(bool can_close, signin.mojom.AccountId? prefilled_account);
// Notification that the remove user warning was shown.
OnRemoveUserWarningShown();
// Try to remove |account_id|.
RemoveUser(signin.mojom.AccountId account_id);
// Launch a public session for user with |account_id|.
// |locale|: Locale for this user.
// The value is language code like "en-US", "zh-CN"
// |input_method|: Input method for this user.
// This is the id of InputMethodDescriptor like
// "t:latn-post", "pinyin".
LaunchPublicSession(signin.mojom.AccountId account_id,
string locale,
string input_method);
// Request public session keyboard layouts for user with |account_id|.
// This function send a request to chrome and the result will be returned by
// SetPublicSessionKeyboardLayouts.
// |locale|: Request a list of keyboard layouts that can be used by this
// locale.
RequestPublicSessionKeyboardLayouts(signin.mojom.AccountId account_id,
string locale);
// Request to show a feedback report dialog in chrome.
ShowFeedback();
// Show the powerwash (device reset) dialog.
ShowResetScreen();
// Show the help app for when users have trouble signing in to their account.
ShowAccountAccessHelpApp();
// Called when the keyboard focus is about to leave from the sytem tray in
// the login screen / OOBE. |reverse| is true when the focus moves in the
// reversed direction.
OnFocusLeavingSystemTray(bool reverse);
// Used by Ash to signal that user activity occurred on the login screen.
OnUserActivity();
};