#ifndef ASH_PUBLIC_CPP_LOCALE_UPDATE_CONTROLLER_H_
#define ASH_PUBLIC_CPP_LOCALE_UPDATE_CONTROLLER_H_
#include <string>
#include "ash/public/cpp/ash_public_export.h"
#include "base/functional/callback_forward.h"
namespace ash {
struct ASH_PUBLIC_EXPORT LocaleInfo {
LocaleInfo();
LocaleInfo(const std::string& iso_code, const std::u16string& display_name);
LocaleInfo(const LocaleInfo& rhs);
LocaleInfo(LocaleInfo&& rhs);
~LocaleInfo();
std::string iso_code;
std::u16string display_name;
};
enum class LocaleNotificationResult {
kAccept,
kRevert,
};
class LocaleChangeObserver {
public:
virtual ~LocaleChangeObserver() = default;
virtual void OnLocaleChanged() = 0;
};
class ASH_PUBLIC_EXPORT LocaleUpdateController {
public:
using LocaleChangeConfirmationCallback =
base::OnceCallback<void(LocaleNotificationResult)>;
static LocaleUpdateController* Get();
virtual void OnLocaleChanged() = 0;
virtual void ConfirmLocaleChange(
const std::string& current_locale,
const std::string& from_locale,
const std::string& to_locale,
LocaleChangeConfirmationCallback callback) = 0;
virtual void AddObserver(LocaleChangeObserver* observer) = 0;
virtual void RemoveObserver(LocaleChangeObserver* observer) = 0;
protected:
LocaleUpdateController();
virtual ~LocaleUpdateController();
};
}
#endif