1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_PUBLIC_CPP_LOGIN_SCREEN_H_ 6 #define ASH_PUBLIC_CPP_LOGIN_SCREEN_H_ 7 8 #include <string> 9 10 #include "ash/public/cpp/ash_public_export.h" 11 #include "ash/public/cpp/login_types.h" 12 #include "base/callback_forward.h" 13 14 namespace ash { 15 16 class LoginScreenClient; 17 class LoginScreenModel; 18 class ScopedGuestButtonBlocker; 19 20 // Allows clients (e.g. the browser process) to send messages to the ash 21 // login/lock/user-add screens. 22 // TODO(estade): move more of mojom::LoginScreen here. 23 class ASH_PUBLIC_EXPORT LoginScreen { 24 public: 25 // Returns the singleton instance. 26 static LoginScreen* Get(); 27 28 virtual void SetClient(LoginScreenClient* client) = 0; 29 30 virtual LoginScreenModel* GetModel() = 0; 31 32 // Displays the lock screen. 33 virtual void ShowLockScreen() = 0; 34 35 // Displays the login screen. 36 virtual void ShowLoginScreen() = 0; 37 38 // Display a toast describing the latest kiosk app launch error. 39 virtual void ShowKioskAppError(const std::string& message) = 0; 40 41 // Transitions focus to the shelf area. If |reverse|, focuses the status area. 42 virtual void FocusLoginShelf(bool reverse) = 0; 43 44 // Returns if the login/lock screen is ready for a password. Currently only 45 // used for testing. 46 virtual bool IsReadyForPassword() = 0; 47 48 // Sets whether users can be added from the login screen. 49 virtual void EnableAddUserButton(bool enable) = 0; 50 51 // Sets whether shutdown button is enabled in the login screen. 52 virtual void EnableShutdownButton(bool enable) = 0; 53 54 // Used to show or hide apps the guest and buttons on the login shelf during 55 // OOBE. 56 virtual void SetIsFirstSigninStep(bool is_first) = 0; 57 58 // Shows or hides the parent access button on the login shelf. 59 virtual void ShowParentAccessButton(bool show) = 0; 60 61 // Sets if the guest button on the login shelf can be shown. Even if set to 62 // true the button may still not be visible. 63 virtual void SetAllowLoginAsGuest(bool allow_guest) = 0; 64 65 // Returns scoped object to temporarily disable Browse as Guest button. 66 virtual std::unique_ptr<ScopedGuestButtonBlocker> 67 GetScopedGuestButtonBlocker() = 0; 68 69 // Called to request the user to enter the PIN of the security token (e.g., 70 // the smart card). 71 virtual void RequestSecurityTokenPin(SecurityTokenPinRequest request) = 0; 72 73 // Called to close the UI previously opened with RequestSecurityTokenPin(). 74 virtual void ClearSecurityTokenPinRequest() = 0; 75 76 // Sets a handler for login shelf gestures. This will enable gesture detection 77 // on the login shelf for upward fling from the shelf. 78 // |message| - The text to be shown above login shelf drag handle. 79 // |fling_callback| - The callback to be called when a fling is detected. 80 // |exit_callback| - The callback to be called when the login shelf gesture 81 // detection stops, for example when the session is unblocked, or the handler 82 // is cleared. 83 // 84 // Returns whether the handler was successfully set. If not, |exit_callback| 85 // will not be run. The handler will not be set if the current shelf state 86 // does not support login shelf gestures, e.g. if the session is active, or 87 // when not in tablet mode. 88 // 89 // Note that this does not support more than one handler - if another handler 90 // is already set, this method will replace it (and the previous handler's 91 // exit_callback will be run). 92 virtual bool SetLoginShelfGestureHandler( 93 const base::string16& message, 94 const base::RepeatingClosure& fling_callback, 95 base::OnceClosure exit_callback) = 0; 96 97 // Stops login shelf gesture detection. 98 virtual void ClearLoginShelfGestureHandler() = 0; 99 100 protected: 101 LoginScreen(); 102 virtual ~LoginScreen(); 103 }; 104 105 } // namespace ash 106 107 #endif // ASH_PUBLIC_CPP_LOGIN_SCREEN_H_ 108