process_manager_factory.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2014 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.
  4. #ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_
  5. #define EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_
  6. #include "base/memory/singleton.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. namespace extensions {
  9. class ProcessManager;
  10. class ProcessManagerFactory : public BrowserContextKeyedServiceFactory {
  11. public:
  12. ProcessManagerFactory(const ProcessManagerFactory&) = delete;
  13. ProcessManagerFactory& operator=(const ProcessManagerFactory&) = delete;
  14. static ProcessManager* GetForBrowserContext(content::BrowserContext* context);
  15. // Returns NULL if there is no ProcessManager associated with this context.
  16. static ProcessManager* GetForBrowserContextIfExists(
  17. content::BrowserContext* context);
  18. static ProcessManagerFactory* GetInstance();
  19. private:
  20. friend struct base::DefaultSingletonTraits<ProcessManagerFactory>;
  21. ProcessManagerFactory();
  22. ~ProcessManagerFactory() override;
  23. // BrowserContextKeyedServiceFactory
  24. KeyedService* BuildServiceInstanceFor(
  25. content::BrowserContext* context) const override;
  26. content::BrowserContext* GetBrowserContextToUse(
  27. content::BrowserContext* context) const override;
  28. };
  29. } // namespace extensions
  30. #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_FACTORY_H_