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

Side by Side Diff: chrome/browser/extensions/settings/testing_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: . 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) 2011 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_TESTING_SETTINGS_STORAGE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_TESTING_SETTINGS_STORAGE_H_
6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_TESTING_SETTINGS_STORAGE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_TESTING_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 // SettingsStorage for testing, with an in-memory storage but the ability to 14 // SettingsStorage for testing, with an in-memory storage but the ability to
15 // optionally fail all operations. 15 // optionally fail all operations.
16 class TestingSettingsStorage : public SettingsStorage { 16 class TestingSettingsStorage : public SettingsStorage {
17 public: 17 public:
18 TestingSettingsStorage(); 18 TestingSettingsStorage();
19 virtual ~TestingSettingsStorage(); 19 virtual ~TestingSettingsStorage();
20 20
21 // Sets whether to fail all requests (default is false). 21 // Sets whether to fail all requests (default is false).
22 void SetFailAllRequests(bool fail_all_requests); 22 void SetFailAllRequests(bool fail_all_requests);
23 23
24 // SettingsStorage implementation. 24 // SettingsStorage implementation.
25 virtual size_t GetBytesInUse() OVERRIDE;
25 virtual ReadResult Get(const std::string& key) OVERRIDE; 26 virtual ReadResult Get(const std::string& key) OVERRIDE;
26 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; 27 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE;
27 virtual ReadResult Get() OVERRIDE; 28 virtual ReadResult Get() OVERRIDE;
28 virtual WriteResult Set( 29 virtual WriteResult Set(
29 WriteOptions options, 30 WriteOptions options,
30 const std::string& key, 31 const std::string& key,
31 const Value& value) OVERRIDE; 32 const Value& value) OVERRIDE;
32 virtual WriteResult Set( 33 virtual WriteResult Set(
33 WriteOptions options, const DictionaryValue& values) OVERRIDE; 34 WriteOptions options, const DictionaryValue& values) OVERRIDE;
34 virtual WriteResult Remove(const std::string& key) OVERRIDE; 35 virtual WriteResult Remove(const std::string& key) OVERRIDE;
35 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; 36 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE;
36 virtual WriteResult Clear() OVERRIDE; 37 virtual WriteResult Clear() OVERRIDE;
37 38
38 private: 39 private:
39 DictionaryValue storage_; 40 DictionaryValue storage_;
40 41
41 bool fail_all_requests_; 42 bool fail_all_requests_;
42 43
43 DISALLOW_COPY_AND_ASSIGN(TestingSettingsStorage); 44 DISALLOW_COPY_AND_ASSIGN(TestingSettingsStorage);
44 }; 45 };
45 46
46 } // namespace extensions 47 } // namespace extensions
47 48
48 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_TESTING_SETTINGS_STORAGE_H_ 49 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_TESTING_SETTINGS_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698