1 // Copyright 2018 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 CHROME_BROWSER_CHROMEOS_SYSTEM_USER_REMOVAL_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_USER_REMOVAL_MANAGER_H_ 7 8 #include "base/callback_forward.h" 9 10 // This file contains a collection of functions that are used to support 11 // removing users from the device. 12 // 13 // InitiateUserRemoval starts the process and restarts the Chrome session back 14 // to the login screen, while RemoveUsersIfNeeded does the actual removal at the 15 // login screen. 16 17 namespace chromeos { 18 namespace user_removal_manager { 19 20 // This function is called early in the startup sequence on the login screen. It 21 // removes users from the device in case the magic pref is set to true, and 22 // otherwise it does nothing. Returns true if users were removed, false 23 // otherwise. 24 bool RemoveUsersIfNeeded(); 25 26 // Performs a log out. Can be overridden for testing. 27 void LogOut(); 28 29 // Overrides LogOut (AttemptUserExit) inside tests with a custom callback that 30 // gets run instead. 31 void OverrideLogOutForTesting(base::OnceClosure callback); 32 33 // Write the magic local_state pref and run the callback once the pref is 34 // persisted to disk (the callback is expected to restart the Chrome session 35 // back to the login screen). Also start a fail-safe timer that shuts down 36 // Chrome in case the callback doesn't do its job in time (eg. callback wants to 37 // do some network communication, but the connection is lost). 38 void InitiateUserRemoval(base::OnceClosure on_pref_persisted_callback); 39 40 } // namespace user_removal_manager 41 } // namespace chromeos 42 43 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_USER_REMOVAL_MANAGER_H_ 44