OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_ | |
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/extensions/api/storage/value_store_cache.h" | |
13 | |
14 namespace base { | |
15 class FilePath; | |
16 } | |
17 | |
18 namespace extensions { | |
19 | |
20 class SettingsBackend; | |
21 class SettingsStorageFactory; | |
22 | |
23 // ValueStoreCache for the LOCAL namespace. It owns a backend for apps and | |
24 // another for extensions. Each backend takes care of persistence. | |
25 class LocalValueStoreCache : public ValueStoreCache { | |
26 public: | |
27 LocalValueStoreCache(const scoped_refptr<SettingsStorageFactory>& factory, | |
28 const base::FilePath& profile_path); | |
29 virtual ~LocalValueStoreCache(); | |
30 | |
31 // ValueStoreCache implementation: | |
32 virtual void RunWithValueStoreForExtension( | |
33 const StorageCallback& callback, | |
34 scoped_refptr<const Extension> extension) OVERRIDE; | |
35 virtual void DeleteStorageSoon(const std::string& extension_id) OVERRIDE; | |
36 | |
37 private: | |
38 void InitOnFileThread(const scoped_refptr<SettingsStorageFactory>& factory, | |
39 const base::FilePath& profile_path); | |
40 | |
41 bool initialized_; | |
42 scoped_ptr<SettingsBackend> app_backend_; | |
43 scoped_ptr<SettingsBackend> extension_backend_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(LocalValueStoreCache); | |
46 }; | |
47 | |
48 } // namespace extensions | |
49 | |
50 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_ | |
OLD | NEW |