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

Side by Side Diff: components/cronet/android/cronet_pref_store.h

Issue 937513003: Add Data Saver support to Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_PREF_STORE_H_ 5 #ifndef COMPONENTS_CRONET_ANDROID_CRONET_PREF_STORE_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_PREF_STORE_H_ 6 #define COMPONENTS_CRONET_ANDROID_CRONET_PREF_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/prefs/persistent_pref_store.h" 13 #include "base/prefs/persistent_pref_store.h"
14 #include "base/prefs/pref_value_map.h" 14 #include "base/prefs/pref_value_map.h"
15 15
16 // A light-weight prefstore implementation that keeps preferences 16 // A light-weight prefstore implementation that keeps preferences
17 // in a memory backed store. This is not a persistent prefstore -- we 17 // in a memory backed store. This is not a persistent prefstore -- we
18 // subclass the PersistentPrefStore here since it is needed by the 18 // subclass the PersistentPrefStore here since it is needed by the
19 // PrefService, which in turn is needed by the Autofill component. 19 // PrefService, which in turn is needed by the Autofill component.
20 class AwPrefStore : public PersistentPrefStore { 20 class CronetPrefStore : public PersistentPrefStore {
mmenke 2015/03/13 18:16:48 Given that this class is identical to the AwPrefSt
bengr 2015/03/19 01:03:51 Good suggestion. Let's do this as a followup.
21 public: 21 public:
22 AwPrefStore(); 22 CronetPrefStore();
23 23
24 // Overriden from PrefStore. 24 // Overrides from PrefStore:
25 bool GetValue(const std::string& key, 25 bool GetValue(const std::string& key,
26 const base::Value** result) const override; 26 const base::Value** result) const override;
27 void AddObserver(PrefStore::Observer* observer) override; 27 void AddObserver(PrefStore::Observer* observer) override;
28 void RemoveObserver(PrefStore::Observer* observer) override; 28 void RemoveObserver(PrefStore::Observer* observer) override;
29 bool HasObservers() const override; 29 bool HasObservers() const override;
30 bool IsInitializationComplete() const override; 30 bool IsInitializationComplete() const override;
31 31
32 // PersistentPrefStore overrides: 32 // PersistentPrefStore overrides:
33 bool GetMutableValue(const std::string& key, base::Value** result) override; 33 bool GetMutableValue(const std::string& key,
34 base::Value** result) override;
34 void ReportValueChanged(const std::string& key) override; 35 void ReportValueChanged(const std::string& key) override;
35 void SetValue(const std::string& key, base::Value* value) override; 36 void SetValue(const std::string& key, base::Value* value) override;
36 void SetValueSilently(const std::string& key, base::Value* value) override; 37 void SetValueSilently(const std::string& key,
38 base::Value* value) override;
37 void RemoveValue(const std::string& key) override; 39 void RemoveValue(const std::string& key) override;
38 bool ReadOnly() const override; 40 bool ReadOnly() const override;
39 PrefReadError GetReadError() const override; 41 PrefReadError GetReadError() const override;
40 PersistentPrefStore::PrefReadError ReadPrefs() override; 42 PersistentPrefStore::PrefReadError ReadPrefs() override;
41 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; 43 void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
42 void CommitPendingWrite() override {} 44 void CommitPendingWrite() override {}
43 45
44 protected: 46 protected:
45 ~AwPrefStore() override; 47 ~CronetPrefStore() override;
46 48
47 private: 49 private:
48 // Stores the preference values. 50 // Stores the preference values.
49 PrefValueMap prefs_; 51 PrefValueMap prefs_;
50 52
51 ObserverList<PrefStore::Observer, true> observers_; 53 ObserverList<PrefStore::Observer, true> observers_;
52 54
53 DISALLOW_COPY_AND_ASSIGN(AwPrefStore); 55 DISALLOW_COPY_AND_ASSIGN(CronetPrefStore);
54 }; 56 };
55 57
56 #endif // ANDROID_WEBVIEW_BROWSER_AW_PREF_STORE_H_ 58 #endif // COMPONENTS_CRONET_ANDROID_CRONET_PREF_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698