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

Unified Diff: chrome/browser/net/sdch_owner_pref_storage.h

Issue 1634653003: Abstract pref storage from net::SdchOwner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@net_prefs
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/sdch_owner_pref_storage.h
diff --git a/chrome/browser/net/sdch_owner_pref_storage.h b/chrome/browser/net/sdch_owner_pref_storage.h
new file mode 100644
index 0000000000000000000000000000000000000000..41bb3fac77771d4d68e5c4fa06663d7dba5ca8d8
--- /dev/null
+++ b/chrome/browser/net/sdch_owner_pref_storage.h
@@ -0,0 +1,50 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_
+#define CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_
+
+#include "base/macros.h"
+#include "base/prefs/pref_store.h"
+#include "net/sdch/sdch_owner.h"
+
+class PersistentPrefStore;
+
+namespace chrome_browser_net {
+
+// Provides and implementation of SdchOwner::PrefStorage that maps to
+// Chrome's preferences system.
+class SdchOwnerPrefStorage
+ : public net::SdchOwner::PrefStorage,
+ public PrefStore::Observer {
+ public:
+ // The storage must outlive this class.
+ explicit SdchOwnerPrefStorage(PersistentPrefStore* storage);
+ ~SdchOwnerPrefStorage() override;
+
+ ReadError GetReadError() const override;
+ bool GetValue(const base::DictionaryValue** result) const override;
+ bool GetMutableValue(base::DictionaryValue** result) override;
+ void SetValue(scoped_ptr<base::DictionaryValue> value) override;
+ void ReportValueChanged() override;
+ bool IsInitializationComplete() override;
+ void StartObservingInit(net::SdchOwner* observer) override;
+ void StopObservingInit() override;
+
+ private:
+ // PrefStore::Observer implementation.
+ void OnPrefValueChanged(const std::string& key) override;
+ void OnInitializationCompleted(bool succeeded) override;
+
+ PersistentPrefStore* storage_; // Non-owning.
+ const std::string storage_key_;
+
+ net::SdchOwner* init_observer_; // Non-owning.
+
+ DISALLOW_COPY_AND_ASSIGN(SdchOwnerPrefStorage);
+};
+
+} // namespace chrome_browser_net
+
+#endif // CHROME_BROWSER_NET_SDCH_OWNER_PREF_STORAGE_H_
« no previous file with comments | « no previous file | chrome/browser/net/sdch_owner_pref_storage.cc » ('j') | chrome/browser/net/sdch_owner_pref_storage.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698