summaryrefslogtreecommitdiff
path: root/chromium/components/prefs/pref_service.cc
diff options
context:
space:
mode:
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) {