summaryrefslogtreecommitdiffstats
path: root/extensions/browser/value_store/value_store_factory_impl.h
blob: d0a0677ec97960eaaa80e850ff88092802f2ec15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_

#include <set>
#include <string>

#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "extensions/browser/value_store/value_store.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/extension.h"

namespace extensions {

class LegacyValueStoreFactory;

// Mint new |ValueStore| instances for use by the extensions system. These are
// used for extension rules, state, and settings.
class ValueStoreFactoryImpl : public ValueStoreFactory {
 public:
  explicit ValueStoreFactoryImpl(const base::FilePath& profile_path);

  // ValueStoreFactory
  scoped_ptr<ValueStore> CreateRulesStore() override;
  scoped_ptr<ValueStore> CreateStateStore() override;
  scoped_ptr<ValueStore> CreateSettingsStore(
      settings_namespace::Namespace settings_namespace,
      ModelType model_type,
      const ExtensionId& extension_id) override;
  void DeleteSettings(settings_namespace::Namespace settings_namespace,
                      ModelType model_type,
                      const ExtensionId& extension_id) override;
  bool HasSettings(settings_namespace::Namespace settings_namespace,
                   ModelType model_type,
                   const ExtensionId& extension_id) override;
  std::set<ExtensionId> GetKnownExtensionIDs(
      settings_namespace::Namespace settings_namespace,
      ModelType model_type) const override;

 private:
  // ValueStoreFactory is refcounted.
  ~ValueStoreFactoryImpl() override;

  scoped_refptr<LegacyValueStoreFactory> legacy_factory_;

  DISALLOW_COPY_AND_ASSIGN(ValueStoreFactoryImpl);
};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_