Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/message_loop_proxy.h" | |
| 13 | |
| 14 class ValueStore; | |
| 15 | |
| 16 namespace extensions { | |
| 17 | |
| 18 class Extension; | |
| 19 | |
| 20 // Each namespace of the storage API implements this interface. | |
| 21 // Instances are created on the UI thread, but from then on live on the loop | |
| 22 // returned by GetMessageLoop() and every methods (except GetMessageLoop()) | |
| 23 // are always called in that loop, including the destructor. | |
| 24 class ValueStoreCache { | |
| 25 public: | |
| 26 typedef base::Callback<void(ValueStore*)> StorageCallback; | |
| 27 | |
| 28 virtual ~ValueStoreCache(); | |
| 29 | |
| 30 // Returns the loop that the methods of this class should be invoked on. | |
| 31 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() const = 0; | |
| 32 | |
| 33 // Requests the cache to invoke |callback| with the appropriate ValueStore | |
| 34 // for the given |extension|. |callback| should be invoked with a NULL | |
| 35 // ValueStore in case of errors. | |
| 36 virtual void RunWithValueStoreForExtension( | |
| 37 const StorageCallback& callback, | |
| 38 scoped_refptr<const Extension> extension) = 0; | |
|
not at google - send to devlin
2012/07/19 06:43:17
see comment in the other file about making this co
| |
| 39 | |
| 40 // Requests the cache to delete any storage used by |extension_id|. | |
| 41 virtual void DeleteStorageSoon(const std::string& extension_id) = 0; | |
| 42 }; | |
| 43 | |
| 44 } // namespace extensions | |
| 45 | |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_SETTINGS_VALUE_STORE_CACHE_H_ | |
| OLD | NEW |