| 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_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_ |
| 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "extensions/browser/api/storage/settings_namespace.h" | 12 #include "extensions/browser/api/storage/settings_namespace.h" |
| 13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 | 14 |
| 15 class ValueStore; | 15 class ValueStore; |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // Create new value stores for rules, state, or settings. For settings will | 19 // Create new value stores for rules, state, or settings. For settings will |
| 20 // also create stores for the specified namespace and model type. | 20 // also create stores for the specified namespace and model type. |
| 21 // | 21 // |
| 22 // Note: This factory creates the lower level stores that directly read/write to | 22 // Note: This factory creates the lower level stores that directly read/write to |
| 23 // disk. Sync/Managed stores are created directly, but delegate their | 23 // disk. Sync/Managed stores are created directly, but delegate their |
| 24 // calls to a |ValueStore| created by this interface. | 24 // calls to a |ValueStore| created by this interface. |
| 25 class ValueStoreFactory : public base::RefCountedThreadSafe<ValueStoreFactory> { | 25 class ValueStoreFactory : public base::RefCountedThreadSafe<ValueStoreFactory> { |
| 26 public: | 26 public: |
| 27 enum class ModelType { APP, EXTENSION }; | 27 enum class ModelType { APP, EXTENSION }; |
| 28 | 28 |
| 29 // Create a |ValueStore| to contain rules data. | 29 // Create a |ValueStore| to contain rules data. |
| 30 virtual scoped_ptr<ValueStore> CreateRulesStore() = 0; | 30 virtual std::unique_ptr<ValueStore> CreateRulesStore() = 0; |
| 31 | 31 |
| 32 // Create a |ValueStore| to contain state data. | 32 // Create a |ValueStore| to contain state data. |
| 33 virtual scoped_ptr<ValueStore> CreateStateStore() = 0; | 33 virtual std::unique_ptr<ValueStore> CreateStateStore() = 0; |
| 34 | 34 |
| 35 // Create a |ValueStore| to contain settings data for a specific extension | 35 // Create a |ValueStore| to contain settings data for a specific extension |
| 36 // namespace and model type. | 36 // namespace and model type. |
| 37 virtual scoped_ptr<ValueStore> CreateSettingsStore( | 37 virtual std::unique_ptr<ValueStore> CreateSettingsStore( |
| 38 settings_namespace::Namespace settings_namespace, | 38 settings_namespace::Namespace settings_namespace, |
| 39 ModelType model_type, | 39 ModelType model_type, |
| 40 const ExtensionId& extension_id) = 0; | 40 const ExtensionId& extension_id) = 0; |
| 41 | 41 |
| 42 // Delete all settings for specified given extension in the specified | 42 // Delete all settings for specified given extension in the specified |
| 43 // namespace/model_type. | 43 // namespace/model_type. |
| 44 virtual void DeleteSettings(settings_namespace::Namespace settings_namespace, | 44 virtual void DeleteSettings(settings_namespace::Namespace settings_namespace, |
| 45 ModelType model_type, | 45 ModelType model_type, |
| 46 const ExtensionId& extension_id) = 0; | 46 const ExtensionId& extension_id) = 0; |
| 47 | 47 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 ModelType model_type) const = 0; | 58 ModelType model_type) const = 0; |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 friend class base::RefCountedThreadSafe<ValueStoreFactory>; | 61 friend class base::RefCountedThreadSafe<ValueStoreFactory>; |
| 62 virtual ~ValueStoreFactory() {} | 62 virtual ~ValueStoreFactory() {} |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 } // namespace extensions | 65 } // namespace extensions |
| 66 | 66 |
| 67 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_ | 67 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_ |
| OLD | NEW |