1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/value_store/value_store.h"
11 namespace extensions {
13 // A ValueStore decorator which makes calls through |Set| ignore quota.
14 // "Weak" because ownership of the delegate isn't taken; this is designed to be
15 // temporarily attached to storage areas.
16 class WeakUnlimitedSettingsStorage : public ValueStore {
18 // Ownership of |delegate| NOT taken.
19 explicit WeakUnlimitedSettingsStorage(ValueStore* delegate);
21 virtual ~WeakUnlimitedSettingsStorage();
23 // ValueStore implementation.
24 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE;
25 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE;
26 virtual size_t GetBytesInUse() OVERRIDE;
27 virtual ReadResult Get(const std::string& key) OVERRIDE;
28 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE;
29 virtual ReadResult Get() OVERRIDE;
30 virtual WriteResult Set(
32 const std::string& key,
33 const Value& value) OVERRIDE;
34 virtual WriteResult Set(
35 WriteOptions options, const base::DictionaryValue& values) OVERRIDE;
36 virtual WriteResult Remove(const std::string& key) OVERRIDE;
37 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE;
38 virtual WriteResult Clear() OVERRIDE;
41 // The delegate storage area, NOT OWNED.
42 ValueStore* const delegate_;
44 DISALLOW_COPY_AND_ASSIGN(WeakUnlimitedSettingsStorage);
47 } // namespace extensions
49 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_WEAK_UNLIMITED_SETTINGS_STORAGE_H_