#include "components/language/core/browser/language_prefs.h"
#include <algorithm>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/strings/strcat.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/language/core/browser/pref_names.h"
#include "components/language/core/common/language_util.h"
#include "components/language/core/common/locale_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/strings/grit/components_locale_settings.h"
#include "ui/base/l10n/l10n_util.h"
namespace language {
const char kFallbackInputMethodLocale[] = …;
void LanguagePrefs::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
LanguagePrefs::LanguagePrefs(PrefService* user_prefs) : … { … }
LanguagePrefs::~LanguagePrefs() { … }
void LanguagePrefs::GetAcceptLanguagesList(
std::vector<std::string>* languages) const { … }
void LanguagePrefs::GetUserSelectedLanguagesList(
std::vector<std::string>* languages) const { … }
void LanguagePrefs::SetUserSelectedLanguagesList(
const std::vector<std::string>& languages) { … }
void LanguagePrefs::GetDeduplicatedUserLanguages(
std::string* deduplicated_languages_string) { … }
void LanguagePrefs::UpdateAcceptLanguagesPref() { … }
#if BUILDFLAG(IS_ANDROID)
std::vector<std::string> LanguagePrefs::GetULPLanguages() {
std::vector<std::string> ulp_languages;
for (const auto& language : prefs_->GetList(language::prefs::kULPLanguages)) {
ulp_languages.push_back(language.GetString());
}
return ulp_languages;
}
void LanguagePrefs::SetULPLanguages(std::vector<std::string> ulp_languages) {
base::Value::List ulp_pref_list;
ulp_pref_list.reserve(ulp_languages.size());
for (const auto& language : ulp_languages) {
ulp_pref_list.Append(language);
}
prefs_->SetList(language::prefs::kULPLanguages, std::move(ulp_pref_list));
}
#endif
bool LanguagePrefs::IsForcedLanguage(const std::string& language) { … }
void LanguagePrefs::InitializeSelectedLanguagesPref() { … }
void ResetLanguagePrefs(PrefService* prefs) { … }
std::string GetFirstLanguage(std::string_view language_list) { … }
}