#ifndef CEF_LIBCEF_BROWSER_PREFS_PREF_STORE_H_
#define CEF_LIBCEF_BROWSER_PREFS_PREF_STORE_H_
#include <stdint.h>
#include <string>
#include "base/compiler_specific.h"
#include "base/observer_list.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/pref_value_map.h"
class CefPrefStore : public PersistentPrefStore {
public:
CefPrefStore();
CefPrefStore(const CefPrefStore&) = delete;
CefPrefStore& operator=(const CefPrefStore&) = delete;
bool GetValue(const std::string& key,
const base::Value** result) const override;
std::unique_ptr<base::DictionaryValue> GetValues() const override;
void AddObserver(PrefStore::Observer* observer) override;
void RemoveObserver(PrefStore::Observer* observer) override;
bool HasObservers() const override;
bool IsInitializationComplete() const override;
bool GetMutableValue(const std::string& key, base::Value** result) override;
void ReportValueChanged(const std::string& key, uint32_t flags) override;
void SetValue(const std::string& key,
std::unique_ptr<base::Value> value,
uint32_t flags) override;
void SetValueSilently(const std::string& key,
std::unique_ptr<base::Value> value,
uint32_t flags) override;
void RemoveValuesByPrefixSilently(const std::string& prefix) override;
void RemoveValue(const std::string& key, uint32_t flags) override;
bool ReadOnly() const override;
PrefReadError GetReadError() const override;
PersistentPrefStore::PrefReadError ReadPrefs() override;
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
virtual void CommitPendingWrite(
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override;
void SchedulePendingLossyWrites() override;
void ClearMutableValues() override;
void OnStoreDeletionFromDisk() override;
void SetInitializationCompleted();
void NotifyPrefValueChanged(const std::string& key);
void NotifyInitializationCompleted();
void SetString(const std::string& key, const std::string& value);
void SetInteger(const std::string& key, int value);
void SetBoolean(const std::string& key, bool value);
bool GetString(const std::string& key, std::string* value) const;
bool GetInteger(const std::string& key, int* value) const;
bool GetBoolean(const std::string& key, bool* value) const;
void SetBlockAsyncRead(bool block_async_read);
virtual void set_read_only(bool read_only);
void set_read_success(bool read_success);
void set_read_error(PersistentPrefStore::PrefReadError read_error);
bool committed() { return committed_; }
protected:
~CefPrefStore() override;
private:
PrefValueMap prefs_;
bool read_only_;
bool read_success_;
PersistentPrefStore::PrefReadError read_error_;
bool block_async_read_;
bool pending_async_read_;
bool init_complete_;
bool committed_;
std::unique_ptr<ReadErrorDelegate> error_delegate_;
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;
};
#endif