[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 5 | #ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_FACTORY_H_ |
6 | #define EXTENSIONS_BROWSER_EXTENSION_PREFS_FACTORY_H_ | ||||
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 7 | |
8 | #include "base/memory/scoped_ptr.h" | ||||
9 | #include "base/memory/singleton.h" | ||||
[email protected] | b33f0b11 | 2014-03-13 17:05:30 | [diff] [blame] | 10 | #include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 11 | |
12 | namespace extensions { | ||||
13 | |||||
14 | class ExtensionPrefs; | ||||
15 | |||||
[email protected] | f1484c5 | 2013-05-22 23:25:44 | [diff] [blame] | 16 | class ExtensionPrefsFactory : public BrowserContextKeyedServiceFactory { |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 17 | public: |
[email protected] | 367d9b17 | 2013-12-03 00:31:02 | [diff] [blame] | 18 | static ExtensionPrefs* GetForBrowserContext(content::BrowserContext* context); |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 19 | |
20 | static ExtensionPrefsFactory* GetInstance(); | ||||
21 | |||||
isherman | 30fa851a | 2015-06-09 23:32:10 | [diff] [blame] | 22 | void SetInstanceForTesting(content::BrowserContext* context, |
23 | scoped_ptr<ExtensionPrefs> prefs); | ||||
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 24 | |
25 | private: | ||||
olli.raula | 36aa8be | 2015-09-10 11:14:22 | [diff] [blame] | 26 | friend struct base::DefaultSingletonTraits<ExtensionPrefsFactory>; |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 27 | |
28 | ExtensionPrefsFactory(); | ||||
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 29 | ~ExtensionPrefsFactory() override; |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 30 | |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 31 | KeyedService* BuildServiceInstanceFor( |
mostynb | 0eac4e1b | 2014-10-03 16:32:19 | [diff] [blame] | 32 | content::BrowserContext* context) const override; |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 33 | content::BrowserContext* GetBrowserContextToUse( |
mostynb | 0eac4e1b | 2014-10-03 16:32:19 | [diff] [blame] | 34 | content::BrowserContext* context) const override; |
[email protected] | 836e298 | 2013-05-16 08:07:42 | [diff] [blame] | 35 | }; |
36 | |||||
37 | } // namespace extensions | ||||
38 | |||||
[email protected] | 489db084 | 2014-01-22 18:20:03 | [diff] [blame] | 39 | #endif // EXTENSIONS_BROWSER_EXTENSION_PREFS_FACTORY_H_ |