1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_FACTORY_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_FACTORY_H_
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/extensions/extension_system_impl.h"
10 #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
11 #include "extensions/browser/extension_system_provider.h"
13 class BrowserContextKeyedService
;
15 namespace extensions
{
16 class ExtensionSystem
;
18 // BrowserContextKeyedServiceFactory for ExtensionSystemImpl::Shared.
19 // Should not be used except by ExtensionSystem(Factory).
20 class ExtensionSystemSharedFactory
: public BrowserContextKeyedServiceFactory
{
22 static ExtensionSystemImpl::Shared
* GetForBrowserContext(
23 content::BrowserContext
* context
);
25 static ExtensionSystemSharedFactory
* GetInstance();
28 friend struct DefaultSingletonTraits
<ExtensionSystemSharedFactory
>;
30 ExtensionSystemSharedFactory();
31 virtual ~ExtensionSystemSharedFactory();
33 // BrowserContextKeyedServiceFactory implementation:
34 virtual BrowserContextKeyedService
* BuildServiceInstanceFor(
35 content::BrowserContext
* context
) const OVERRIDE
;
36 virtual content::BrowserContext
* GetBrowserContextToUse(
37 content::BrowserContext
* context
) const OVERRIDE
;
39 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemSharedFactory
);
42 // BrowserContextKeyedServiceFactory for ExtensionSystemImpl.
43 // TODO(yoz): Rename to ExtensionSystemImplFactory.
44 class ExtensionSystemFactory
: public ExtensionSystemProvider
{
46 // ExtensionSystem provider implementation:
47 virtual ExtensionSystem
* GetForBrowserContext(
48 content::BrowserContext
* context
) OVERRIDE
;
50 static ExtensionSystemFactory
* GetInstance();
53 friend struct DefaultSingletonTraits
<ExtensionSystemFactory
>;
55 ExtensionSystemFactory();
56 virtual ~ExtensionSystemFactory();
58 // BrowserContextKeyedServiceFactory implementation:
59 virtual BrowserContextKeyedService
* BuildServiceInstanceFor(
60 content::BrowserContext
* context
) const OVERRIDE
;
61 virtual content::BrowserContext
* GetBrowserContextToUse(
62 content::BrowserContext
* context
) const OVERRIDE
;
63 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE
;
65 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemFactory
);
68 } // namespace extensions
70 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_FACTORY_H_