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_EXTENSION_SETTINGS_STORAGE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual ~Callback() {} | 23 virtual ~Callback() {} |
24 | 24 |
25 // Indicates the storage operation was successful. Settings value will be | 25 // Indicates the storage operation was successful. Settings value will be |
26 // non-NULL. Ownership is passed to the callback. | 26 // non-NULL. Ownership is passed to the callback. |
27 virtual void OnSuccess(DictionaryValue* settings) = 0; | 27 virtual void OnSuccess(DictionaryValue* settings) = 0; |
28 | 28 |
29 // Indicates the storage operation failed. Messages describes the failure. | 29 // Indicates the storage operation failed. Messages describes the failure. |
30 virtual void OnFailure(const std::string& message) = 0; | 30 virtual void OnFailure(const std::string& message) = 0; |
31 }; | 31 }; |
32 | 32 |
| 33 // Callback which does nothing. |
| 34 class NoopCallback : public Callback { |
| 35 public: |
| 36 virtual ~NoopCallback() {} |
| 37 virtual void OnSuccess(DictionaryValue* s) OVERRIDE { delete s; } |
| 38 virtual void OnFailure(const std::string& message) OVERRIDE {} |
| 39 }; |
| 40 |
33 // The different types of extension settings storage. | 41 // The different types of extension settings storage. |
34 enum Type { | 42 enum Type { |
35 NONE, | 43 NONE, |
36 NOOP, | 44 NOOP, |
37 LEVELDB | 45 LEVELDB |
38 }; | 46 }; |
39 | 47 |
40 virtual ~ExtensionSettingsStorage() {} | 48 virtual ~ExtensionSettingsStorage() {} |
41 | 49 |
42 // Destroys this settings storage object. This is needed as a separate | 50 // Destroys this settings storage object. This is needed as a separate |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Removes multiple keys from the map. Callback with a dictionary mapping | 82 // Removes multiple keys from the map. Callback with a dictionary mapping |
75 // each key to its new value; on success, this will be an empty map. | 83 // each key to its new value; on success, this will be an empty map. |
76 virtual void Remove(const ListValue& keys, Callback* callback) = 0; | 84 virtual void Remove(const ListValue& keys, Callback* callback) = 0; |
77 | 85 |
78 // Clears the storage. Callback with a dictionary mapping every key in | 86 // Clears the storage. Callback with a dictionary mapping every key in |
79 // storage to its value; on success, this will be an empty map. | 87 // storage to its value; on success, this will be an empty map. |
80 virtual void Clear(Callback *callback) = 0; | 88 virtual void Clear(Callback *callback) = 0; |
81 }; | 89 }; |
82 | 90 |
83 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_H_ | 91 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_STORAGE_H_ |
OLD | NEW |