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

Side by Side Diff: chrome/browser/extensions/settings/weak_unlimited_settings_storage.h

Issue 9284013: Extension Storage API: expose storage quota information to extensions, via: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "chrome/browser/extensions/settings/settings_storage.h" 10 #include "chrome/browser/extensions/settings/settings_storage.h"
11 11
12 namespace extensions { 12 namespace extensions {
13 13
14 // A SettingsStorage decorator which makes calls through |Set| ignore quota. 14 // A SettingsStorage decorator which makes calls through |Set| ignore quota.
15 // "Weak" because ownership of the delegate isn't taken; this is designed to be 15 // "Weak" because ownership of the delegate isn't taken; this is designed to be
16 // temporarily attached to storage areas. 16 // temporarily attached to storage areas.
17 class WeakUnlimitedSettingsStorage : public SettingsStorage { 17 class WeakUnlimitedSettingsStorage : public SettingsStorage {
18 public: 18 public:
19 // Ownership of |delegate| NOT taken. 19 // Ownership of |delegate| NOT taken.
20 explicit WeakUnlimitedSettingsStorage(SettingsStorage* delegate); 20 explicit WeakUnlimitedSettingsStorage(SettingsStorage* delegate);
21 21
22 virtual ~WeakUnlimitedSettingsStorage(); 22 virtual ~WeakUnlimitedSettingsStorage();
23 23
24 // SettingsStorage implementation. 24 // SettingsStorage implementation.
25 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE;
26 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE;
27 virtual size_t GetBytesInUse() OVERRIDE;
25 virtual ReadResult Get(const std::string& key) OVERRIDE; 28 virtual ReadResult Get(const std::string& key) OVERRIDE;
26 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; 29 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE;
27 virtual ReadResult Get() OVERRIDE; 30 virtual ReadResult Get() OVERRIDE;
28 virtual WriteResult Set( 31 virtual WriteResult Set(
29 WriteOptions options, 32 WriteOptions options,
30 const std::string& key, 33 const std::string& key,
31 const Value& value) OVERRIDE; 34 const Value& value) OVERRIDE;
32 virtual WriteResult Set( 35 virtual WriteResult Set(
33 WriteOptions options, const DictionaryValue& values) OVERRIDE; 36 WriteOptions options, const DictionaryValue& values) OVERRIDE;
34 virtual WriteResult Remove(const std::string& key) OVERRIDE; 37 virtual WriteResult Remove(const std::string& key) OVERRIDE;
35 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; 38 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE;
36 virtual WriteResult Clear() OVERRIDE; 39 virtual WriteResult Clear() OVERRIDE;
37 40
38 private: 41 private:
39 // The delegate storage area, NOT OWNED. 42 // The delegate storage area, NOT OWNED.
40 SettingsStorage* const delegate_; 43 SettingsStorage* const delegate_;
41 44
42 DISALLOW_COPY_AND_ASSIGN(WeakUnlimitedSettingsStorage); 45 DISALLOW_COPY_AND_ASSIGN(WeakUnlimitedSettingsStorage);
43 }; 46 };
44 47
45 } // namespace extensions 48 } // namespace extensions
46 49
47 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_ 50 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_WEAK_UNLIMITED_SETTINGS_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698