Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / storage / local_value_store_cache.h
blobb7cdcbe3df47590f76e698b4b9400177d95a7143
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.
5 #ifndef EXTENSIONS_BROWSER_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_
6 #define EXTENSIONS_BROWSER_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
15 #include "extensions/browser/api/storage/value_store_cache.h"
17 namespace extensions {
19 class SettingsStorageFactory;
21 // ValueStoreCache for the LOCAL namespace. It owns a backend for apps and
22 // another for extensions. Each backend takes care of persistence.
23 class LocalValueStoreCache : public ValueStoreCache {
24 public:
25 LocalValueStoreCache(const scoped_refptr<SettingsStorageFactory>& factory,
26 const base::FilePath& profile_path);
27 ~LocalValueStoreCache() override;
29 // ValueStoreCache implementation:
30 void RunWithValueStoreForExtension(
31 const StorageCallback& callback,
32 scoped_refptr<const Extension> extension) override;
33 void DeleteStorageSoon(const std::string& extension_id) override;
35 private:
36 typedef std::map<std::string, linked_ptr<ValueStore> > StorageMap;
38 ValueStore* GetStorage(scoped_refptr<const Extension> extension);
40 // The Factory to use for creating new ValueStores.
41 const scoped_refptr<SettingsStorageFactory> storage_factory_;
43 // The base path to use for extensions when creating new ValueStores.
44 const base::FilePath extension_base_path_;
46 // The base path to use for apps when creating new ValueStores.
47 const base::FilePath app_base_path_;
49 // Quota limits (see SettingsStorageQuotaEnforcer).
50 const SettingsStorageQuotaEnforcer::Limits quota_;
52 // The collection of ValueStores for local storage.
53 StorageMap storage_map_;
55 DISALLOW_COPY_AND_ASSIGN(LocalValueStoreCache);
58 } // namespace extensions
60 #endif // EXTENSIONS_BROWSER_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_