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 const std::string& key, |
| 36 const Value& value) OVERRIDE; |
| 37 virtual WriteResult Set( |
| 38 WriteOptions options, const DictionaryValue& values) OVERRIDE; |
35 virtual WriteResult Remove(const std::string& key) OVERRIDE; | 39 virtual WriteResult Remove(const std::string& key) OVERRIDE; |
36 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; | 40 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; |
37 virtual WriteResult Clear() OVERRIDE; | 41 virtual WriteResult Clear() OVERRIDE; |
38 | 42 |
39 private: | 43 private: |
40 // Returns whether the value was found in the cache. | 44 // Returns whether the value was found in the cache. |
41 // Ownership of value is released to the caller and placed in value. | 45 // Ownership of value is released to the caller and placed in value. |
42 bool GetFromCache(const std::string& key, Value** value); | 46 bool GetFromCache(const std::string& key, Value** value); |
43 | 47 |
44 // Storage that the cache is wrapping. | 48 // Storage that the cache is wrapping. |
45 scoped_ptr<SettingsStorage> delegate_; | 49 scoped_ptr<SettingsStorage> delegate_; |
46 | 50 |
47 // The in-memory cache of settings from the delegate. | 51 // The in-memory cache of settings from the delegate. |
48 DictionaryValue cache_; | 52 DictionaryValue cache_; |
49 | 53 |
50 DISALLOW_COPY_AND_ASSIGN(SettingsStorageCache); | 54 DISALLOW_COPY_AND_ASSIGN(SettingsStorageCache); |
51 }; | 55 }; |
52 | 56 |
53 } // namespace extensions | 57 } // namespace extensions |
54 | 58 |
55 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_SETTINGS_STORAGE_CACHE_H_ |
OLD | NEW |