Avi Drissman | 60039d4 | 2022-09-13 21:49:05 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [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 | |
| 5 | #ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_ |
| 6 | #define EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_ |
| 7 | |
| 8 | #include "base/memory/singleton.h" |
| 9 | #include "components/keyed_service/content/browser_context_keyed_service_factory.h" |
| 10 | |
| 11 | namespace extensions { |
| 12 | |
| 13 | class ProcessManager; |
| 14 | |
| 15 | class ProcessManagerFactory : public BrowserContextKeyedServiceFactory { |
| 16 | public: |
Peter Boström | c3d90717 | 2021-09-24 18:39:52 | [diff] [blame] | 17 | ProcessManagerFactory(const ProcessManagerFactory&) = delete; |
| 18 | ProcessManagerFactory& operator=(const ProcessManagerFactory&) = delete; |
| 19 | |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 20 | static ProcessManager* GetForBrowserContext(content::BrowserContext* context); |
| 21 | // Returns NULL if there is no ProcessManager associated with this context. |
| 22 | static ProcessManager* GetForBrowserContextIfExists( |
| 23 | content::BrowserContext* context); |
| 24 | static ProcessManagerFactory* GetInstance(); |
| 25 | |
| 26 | private: |
olli.raula | 36aa8be | 2015-09-10 11:14:22 | [diff] [blame] | 27 | friend struct base::DefaultSingletonTraits<ProcessManagerFactory>; |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 28 | |
| 29 | ProcessManagerFactory(); |
dcheng | afa7602 | 2014-12-28 20:31:56 | [diff] [blame] | 30 | ~ProcessManagerFactory() override; |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 31 | |
| 32 | // BrowserContextKeyedServiceFactory |
dcheng | afa7602 | 2014-12-28 20:31:56 | [diff] [blame] | 33 | KeyedService* BuildServiceInstanceFor( |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 34 | content::BrowserContext* context) const override; |
dcheng | afa7602 | 2014-12-28 20:31:56 | [diff] [blame] | 35 | content::BrowserContext* GetBrowserContextToUse( |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 36 | content::BrowserContext* context) const override; |
reillyg | 0ea3fa90 | 2014-10-28 15:30:23 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | } // namespace extensions |
| 40 | |
| 41 | #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_ |