From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/components/prefs/pref_service.cc | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'chromium/components/prefs/pref_service.cc') diff --git a/chromium/components/prefs/pref_service.cc b/chromium/components/prefs/pref_service.cc index ba16dd4311a..5da0e2bcda1 100644 --- a/chromium/components/prefs/pref_service.cc +++ b/chromium/components/prefs/pref_service.cc @@ -23,12 +23,15 @@ #include "base/strings/string_util.h" #include "base/threading/thread_task_runner_handle.h" #include "base/util/values/values_util.h" -#include "base/value_conversions.h" #include "build/build_config.h" #include "components/prefs/default_pref_store.h" #include "components/prefs/pref_notifier_impl.h" #include "components/prefs/pref_registry.h" +#if defined(OS_ANDROID) +#include "components/prefs/android/pref_service_android.h" +#endif + namespace { class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate { @@ -206,14 +209,12 @@ std::string PrefService::GetString(const std::string& path) const { base::FilePath PrefService::GetFilePath(const std::string& path) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - base::FilePath result; - const base::Value* value = GetPreferenceValueChecked(path); if (!value) - return base::FilePath(result); - bool rv = base::GetValueAsFilePath(*value, &result); - DCHECK(rv); - return result; + return base::FilePath(); + base::Optional result = util::ValueToFilePath(*value); + DCHECK(result); + return *result; } bool PrefService::HasPrefPath(const std::string& path) const { @@ -470,6 +471,15 @@ void PrefService::RemovePrefObserverAllPrefs(PrefObserver* obs) { pref_notifier_->RemovePrefObserverAllPrefs(obs); } +#if defined(OS_ANDROID) +base::android::ScopedJavaLocalRef PrefService::GetJavaObject() { + if (!pref_service_android_) { + pref_service_android_ = std::make_unique(this); + } + return pref_service_android_->GetJavaObject(); +} +#endif + void PrefService::Set(const std::string& path, const base::Value& value) { SetUserPrefValue(path, value.Clone()); } @@ -492,7 +502,7 @@ void PrefService::SetString(const std::string& path, const std::string& value) { void PrefService::SetFilePath(const std::string& path, const base::FilePath& value) { - SetUserPrefValue(path, base::CreateFilePathValue(value)); + SetUserPrefValue(path, util::FilePathToValue(value)); } void PrefService::SetInt64(const std::string& path, int64_t value) { -- cgit v1.2.1