Index: services/preferences/persistent_pref_store_impl.h |
diff --git a/services/preferences/persistent_pref_store_impl.h b/services/preferences/persistent_pref_store_impl.h |
index 9b7aeff89adabb1b802046749d659e40e400ae0c..40b2371417b422beecab288742ea0a34b457f81b 100644 |
--- a/services/preferences/persistent_pref_store_impl.h |
+++ b/services/preferences/persistent_pref_store_impl.h |
@@ -20,17 +20,24 @@ class Value; |
namespace prefs { |
-class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector, |
- public PrefStore::Observer { |
+class PersistentPrefStoreImpl : public PrefStore::Observer { |
public: |
+ using ConnectCallback = |
+ base::Callback<void(mojom::PersistentPrefStoreConfigurationPtr)>; |
+ |
+ // If |initialized()| is false after construction, |on_initialized| will be |
+ // called when it becomes true. |
PersistentPrefStoreImpl( |
scoped_refptr<PersistentPrefStore> backing_pref_store, |
- mojom::TrackedPreferenceValidationDelegatePtr validation_delegate); |
+ mojom::TrackedPreferenceValidationDelegatePtr validation_delegate, |
+ base::Closure on_initialized); |
~PersistentPrefStoreImpl() override; |
- // mojom::PersistentPrefStoreConnector override: |
- void Connect(const ConnectCallback& callback) override; |
+ mojom::PersistentPrefStoreConnectionPtr Connect( |
+ mojom::PrefRegistryPtr pref_registry); |
+ |
+ bool initialized() { return !initializing_; } |
private: |
class Connection; |
@@ -47,18 +54,17 @@ class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector, |
void OnPrefValueChanged(const std::string& key) override; |
void OnInitializationCompleted(bool succeeded) override; |
- void CallConnectCallback( |
- const mojom::PersistentPrefStoreConnector::ConnectCallback& callback); |
void OnConnectionError(Connection* connection); |
scoped_refptr<PersistentPrefStore> backing_pref_store_; |
mojom::TrackedPreferenceValidationDelegatePtr validation_delegate_; |
bool initializing_ = false; |
- std::vector<ConnectCallback> pending_connect_callbacks_; |
std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_; |
+ base::Closure on_initialized_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl); |
}; |