0

Add (empty) default implementations for PrefStore::Observer methods.

This is a small preparation for changing the signature of
OnPrefValueChanged to take a std::string_view. Currently, there is a
third-party implementation of PrefStore::Observer inside libaddress.
Adding default implementations lets us remove that method override
from libaddress and makes changing the function signature possible
in a single (follow-up) CL.

Bug: 349741884
Change-Id: I15d460aaf62a13519c93de78c932d1acdd53fddd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5662299
Auto-Submit: Jan Keitel <jkeitel@google.com>
Reviewed-by: Dominic Battré <battre@chromium.org>
Commit-Queue: Jan Keitel <jkeitel@google.com>
Commit-Queue: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1320241}
This commit is contained in:
Jan Keitel
2024-06-27 11:46:50 +00:00
committed by Chromium LUCI CQ
parent 25e04f09c7
commit 1b60e21b52

@ -26,15 +26,15 @@ class COMPONENTS_PREFS_EXPORT PrefStore : public base::RefCounted<PrefStore> {
class COMPONENTS_PREFS_EXPORT Observer {
public:
// Called when the value for the given |key| in the store changes.
virtual void OnPrefValueChanged(const std::string& key) = 0;
virtual void OnPrefValueChanged(const std::string& key) {}
// Notification about the PrefStore being fully initialized.
virtual void OnInitializationCompleted(bool succeeded) = 0;
virtual void OnInitializationCompleted(bool succeeded) {}
protected:
virtual ~Observer() {}
virtual ~Observer() = default;
};
PrefStore() {}
PrefStore() = default;
PrefStore(const PrefStore&) = delete;
PrefStore& operator=(const PrefStore&) = delete;
@ -58,7 +58,7 @@ class COMPONENTS_PREFS_EXPORT PrefStore : public base::RefCounted<PrefStore> {
protected:
friend class base::RefCounted<PrefStore>;
virtual ~PrefStore() {}
virtual ~PrefStore() = default;
};
#endif // COMPONENTS_PREFS_PREF_STORE_H_