#ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SETTINGS_RESET_SETTINGS_HANDLER_H_
#include <memory>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/profile_resetter/profile_reset_report.pb.h"
#include "chrome/browser/profile_resetter/profile_resetter.h"
#include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
#include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
#include "components/prefs/pref_registry_simple.h"
class Profile;
class ResettableSettingsSnapshot;
namespace settings {
class ResetSettingsHandler : public SettingsPageUIHandler {
public:
#if BUILDFLAG(IS_CHROMEOS)
static const char kCctResetSettingsHash[];
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
#endif
static bool ShouldShowResetProfileBanner(Profile* profile);
explicit ResetSettingsHandler(Profile* profile);
ResetSettingsHandler(const ResetSettingsHandler&) = delete;
ResetSettingsHandler& operator=(const ResetSettingsHandler&) = delete;
~ResetSettingsHandler() override;
void RegisterMessages() override;
void OnJavascriptAllowed() override {}
void OnJavascriptDisallowed() override;
void HandleGetTamperedPreferencePaths(const base::Value::List& args);
protected:
virtual ProfileResetter* GetResetter();
void HandleResetProfileSettings(const base::Value::List& args);
private:
void HandleGetReportedSettings(const base::Value::List& args);
void OnGetReportedSettingsDone(std::string callback_id);
void OnShowResetProfileDialog(const base::Value::List& args);
void OnHideResetProfileDialog(const base::Value::List& args);
void OnHideResetProfileBanner(const base::Value::List& args);
void HandleGetTriggeredResetToolName(const base::Value::List& args);
void ResetSettings(ProfileResetter::ResettableFlags resettable_flags,
base::OnceClosure callback);
void ResetProfile(
const std::string& callback_id,
bool send_settings,
reset_report::ChromeResetReport::ResetRequestOrigin request_origin);
void OnResetProfileSettingsDone(
std::string callback_id,
bool send_feedback,
reset_report::ChromeResetReport::ResetRequestOrigin request_origin);
#if BUILDFLAG(IS_CHROMEOS)
void OnShowSanitizeDialog(const base::Value::List& args);
#endif
const raw_ptr<Profile> profile_;
std::unique_ptr<ProfileResetter> resetter_;
std::unique_ptr<ResettableSettingsSnapshot> setting_snapshot_;
base::WeakPtrFactory<ResetSettingsHandler> callback_weak_ptr_factory_{this};
};
}
#endif