| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ |
| 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "extensions/browser/value_store/value_store.h" | 14 #include "extensions/browser/value_store/value_store.h" |
| 15 #include "extensions/browser/value_store/value_store_factory.h" | 15 #include "extensions/browser/value_store/value_store_factory.h" |
| 16 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 class LegacyValueStoreFactory; | 20 class LegacyValueStoreFactory; |
| 21 | 21 |
| 22 // Mint new |ValueStore| instances for use by the extensions system. These are | 22 // Mint new |ValueStore| instances for use by the extensions system. These are |
| 23 // used for extension rules, state, and settings. | 23 // used for extension rules, state, and settings. |
| 24 class ValueStoreFactoryImpl : public ValueStoreFactory { | 24 class ValueStoreFactoryImpl : public ValueStoreFactory { |
| 25 public: | 25 public: |
| 26 explicit ValueStoreFactoryImpl(const base::FilePath& profile_path); | 26 explicit ValueStoreFactoryImpl(const base::FilePath& profile_path); |
| 27 | 27 |
| 28 // ValueStoreFactory | 28 // ValueStoreFactory |
| 29 scoped_ptr<ValueStore> CreateRulesStore() override; | 29 std::unique_ptr<ValueStore> CreateRulesStore() override; |
| 30 scoped_ptr<ValueStore> CreateStateStore() override; | 30 std::unique_ptr<ValueStore> CreateStateStore() override; |
| 31 scoped_ptr<ValueStore> CreateSettingsStore( | 31 std::unique_ptr<ValueStore> CreateSettingsStore( |
| 32 settings_namespace::Namespace settings_namespace, | 32 settings_namespace::Namespace settings_namespace, |
| 33 ModelType model_type, | 33 ModelType model_type, |
| 34 const ExtensionId& extension_id) override; | 34 const ExtensionId& extension_id) override; |
| 35 void DeleteSettings(settings_namespace::Namespace settings_namespace, | 35 void DeleteSettings(settings_namespace::Namespace settings_namespace, |
| 36 ModelType model_type, | 36 ModelType model_type, |
| 37 const ExtensionId& extension_id) override; | 37 const ExtensionId& extension_id) override; |
| 38 bool HasSettings(settings_namespace::Namespace settings_namespace, | 38 bool HasSettings(settings_namespace::Namespace settings_namespace, |
| 39 ModelType model_type, | 39 ModelType model_type, |
| 40 const ExtensionId& extension_id) override; | 40 const ExtensionId& extension_id) override; |
| 41 std::set<ExtensionId> GetKnownExtensionIDs( | 41 std::set<ExtensionId> GetKnownExtensionIDs( |
| 42 settings_namespace::Namespace settings_namespace, | 42 settings_namespace::Namespace settings_namespace, |
| 43 ModelType model_type) const override; | 43 ModelType model_type) const override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // ValueStoreFactory is refcounted. | 46 // ValueStoreFactory is refcounted. |
| 47 ~ValueStoreFactoryImpl() override; | 47 ~ValueStoreFactoryImpl() override; |
| 48 | 48 |
| 49 scoped_refptr<LegacyValueStoreFactory> legacy_factory_; | 49 scoped_refptr<LegacyValueStoreFactory> legacy_factory_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ValueStoreFactoryImpl); | 51 DISALLOW_COPY_AND_ASSIGN(ValueStoreFactoryImpl); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace extensions | 54 } // namespace extensions |
| 55 | 55 |
| 56 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ | 56 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_ |
| OLD | NEW |