OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_ |
| 6 #define CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/prefs/pref_store.h" |
| 10 #include "net/sdch/sdch_owner.h" |
| 11 |
| 12 class PersistentPrefStore; |
| 13 |
| 14 namespace chrome_browser_net { |
| 15 |
| 16 // Provides an implementation of SdchOwner::PrefStorage that maps to |
| 17 // Chrome's preferences system. |
| 18 class SdchOwnerPrefStorage |
| 19 : public net::SdchOwner::PrefStorage, |
| 20 public PrefStore::Observer { |
| 21 public: |
| 22 // The storage must outlive this class. |
| 23 explicit SdchOwnerPrefStorage(PersistentPrefStore* storage); |
| 24 ~SdchOwnerPrefStorage() override; |
| 25 |
| 26 ReadError GetReadError() const override; |
| 27 bool GetValue(const base::DictionaryValue** result) const override; |
| 28 bool GetMutableValue(base::DictionaryValue** result) override; |
| 29 void SetValue(scoped_ptr<base::DictionaryValue> value) override; |
| 30 void ReportValueChanged() override; |
| 31 bool IsInitializationComplete() override; |
| 32 void StartObservingInit(net::SdchOwner* observer) override; |
| 33 void StopObservingInit() override; |
| 34 |
| 35 private: |
| 36 // PrefStore::Observer implementation. |
| 37 void OnPrefValueChanged(const std::string& key) override; |
| 38 void OnInitializationCompleted(bool succeeded) override; |
| 39 |
| 40 PersistentPrefStore* storage_; // Non-owning. |
| 41 const std::string storage_key_; |
| 42 |
| 43 net::SdchOwner* init_observer_; // Non-owning. |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(SdchOwnerPrefStorage); |
| 46 }; |
| 47 |
| 48 } // namespace chrome_browser_net |
| 49 |
| 50 #endif // CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_ |
OLD | NEW |