Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: services/preferences/public/cpp/pref_store_adapter.h

Issue 2635153002: Pref service: expose all read-only PrefStores through Mojo (Closed)
Patch Set: Address bauerb's review comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_ADAPTER_H_
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_ADAPTER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/values.h"
12 #include "components/prefs/pref_store.h"
13 #include "services/preferences/public/cpp/pref_store_impl.h"
14
15 namespace prefs {
16
17 // Ties the lifetime of a |PrefStoreImpl| to a |PrefStore|. Otherwise acts as a
18 // |PrefStore|, forwarding all calls to the wrapped |PrefStore|.
19 class PrefStoreAdapter : public PrefStore {
20 public:
21 PrefStoreAdapter(scoped_refptr<PrefStore> pref_store,
22 std::unique_ptr<PrefStoreImpl> impl);
23
24 // PrefStore:
25 void AddObserver(PrefStore::Observer* observer) override;
26 void RemoveObserver(PrefStore::Observer* observer) override;
27 bool HasObservers() const override;
28 bool IsInitializationComplete() const override;
29 bool GetValue(const std::string& key,
30 const base::Value** result) const override;
31 std::unique_ptr<base::DictionaryValue> GetValues() const override;
32
33 private:
34 ~PrefStoreAdapter() override;
35
36 scoped_refptr<PrefStore> pref_store_;
37 std::unique_ptr<PrefStoreImpl> impl_;
38
39 DISALLOW_COPY_AND_ASSIGN(PrefStoreAdapter);
40 };
41
42 } // namespace prefs
43
44 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_ADAPTER_H_
OLDNEW
« no previous file with comments | « services/preferences/public/cpp/BUILD.gn ('k') | services/preferences/public/cpp/pref_store_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698