OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class SettingsStorageCache : public SettingsStorage { | 23 class SettingsStorageCache : public SettingsStorage { |
24 public: | 24 public: |
25 // Ownership of delegate taken. | 25 // Ownership of delegate taken. |
26 explicit SettingsStorageCache(SettingsStorage* delegate); | 26 explicit SettingsStorageCache(SettingsStorage* delegate); |
27 virtual ~SettingsStorageCache(); | 27 virtual ~SettingsStorageCache(); |
28 | 28 |
29 // SettingsStorage implementation. | 29 // SettingsStorage implementation. |
30 virtual ReadResult Get(const std::string& key) OVERRIDE; | 30 virtual ReadResult Get(const std::string& key) OVERRIDE; |
31 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; | 31 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; |
32 virtual ReadResult Get() OVERRIDE; | 32 virtual ReadResult Get() OVERRIDE; |
33 virtual WriteResult Set(const std::string& key, const Value& value) OVERRIDE; | 33 virtual WriteResult Set( |
34 virtual WriteResult Set(const DictionaryValue& settings) OVERRIDE; | 34 WriteOptions options, |
35 virtual WriteResult Remove(const std::string& key) OVERRIDE; | 35 const std::string& key, |
36 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; | 36 const Value& value) OVERRIDE; |
37 virtual WriteResult Clear() OVERRIDE; | 37 virtual WriteResult Set( |
| 38 WriteOptions options, const DictionaryValue& values) OVERRIDE; |
| 39 virtual WriteResult Remove( |
| 40 WriteOptions options, const std::string& key) OVERRIDE; |
| 41 virtual WriteResult Remove( |
| 42 WriteOptions options, const std::vector<std::string>& keys) OVERRIDE; |
| 43 virtual WriteResult Clear(WriteOptions options) OVERRIDE; |
38 | 44 |
39 private: | 45 private: |
40 // Returns whether the value was found in the cache. | 46 // Returns whether the value was found in the cache. |
41 // Ownership of value is released to the caller and placed in value. | 47 // Ownership of value is released to the caller and placed in value. |
42 bool GetFromCache(const std::string& key, Value** value); | 48 bool GetFromCache(const std::string& key, Value** value); |
43 | 49 |
44 // Storage that the cache is wrapping. | 50 // Storage that the cache is wrapping. |
45 scoped_ptr<SettingsStorage> delegate_; | 51 scoped_ptr<SettingsStorage> delegate_; |
46 | 52 |
47 // The in-memory cache of settings from the delegate. | 53 // The in-memory cache of settings from the delegate. |
48 DictionaryValue cache_; | 54 DictionaryValue cache_; |
49 | 55 |
50 DISALLOW_COPY_AND_ASSIGN(SettingsStorageCache); | 56 DISALLOW_COPY_AND_ASSIGN(SettingsStorageCache); |
51 }; | 57 }; |
52 | 58 |
53 } // namespace extensions | 59 } // namespace extensions |
54 | 60 |
55 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ | 61 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ |
OLD | NEW |