summaryrefslogtreecommitdiff
path: root/chromium/components/prefs/pref_service.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/components/prefs/pref_service.cc
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/prefs/pref_service.cc')
-rw-r--r--chromium/components/prefs/pref_service.cc26
1 files changed, 18 insertions, 8 deletions
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<base::FilePath> 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<jobject> PrefService::GetJavaObject() {
+ if (!pref_service_android_) {
+ pref_service_android_ = std::make_unique<PrefServiceAndroid>(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) {