/chrome/browser/extensions/api/search_engines_private/search_engines_private_event_router_factory.h

https://gitlab.com/jonnialva90/iridium-browser · C Header · 52 lines · 28 code · 13 blank · 11 comment · 0 complexity · 7b42b665b3eb90aa0e1a5eca79f748ac MD5 · raw file

  1. // Copyright 2015 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 CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_EVENT_ROUTER_FACTORY_H_
  5. #define CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_EVENT_ROUTER_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 SearchEnginesPrivateEventRouter;
  10. // This is a factory class used by the BrowserContextDependencyManager
  11. // to instantiate the searchEnginesPrivate event router per profile (since the
  12. // extension event router is per profile).
  13. class SearchEnginesPrivateEventRouterFactory
  14. : public BrowserContextKeyedServiceFactory {
  15. public:
  16. // Returns the SearchEnginesPrivateEventRouter for |profile|, creating it if
  17. // it is not yet created.
  18. static SearchEnginesPrivateEventRouter* GetForProfile(
  19. content::BrowserContext* context);
  20. // Returns the SearchEnginesPrivateEventRouterFactory instance.
  21. static SearchEnginesPrivateEventRouterFactory* GetInstance();
  22. protected:
  23. // BrowserContextKeyedBaseFactory overrides:
  24. content::BrowserContext* GetBrowserContextToUse(
  25. content::BrowserContext* context) const override;
  26. bool ServiceIsCreatedWithBrowserContext() const override;
  27. bool ServiceIsNULLWhileTesting() const override;
  28. private:
  29. friend struct base::DefaultSingletonTraits<
  30. SearchEnginesPrivateEventRouterFactory>;
  31. SearchEnginesPrivateEventRouterFactory();
  32. ~SearchEnginesPrivateEventRouterFactory() override;
  33. // BrowserContextKeyedServiceFactory:
  34. KeyedService* BuildServiceInstanceFor(
  35. content::BrowserContext* profile) const override;
  36. DISALLOW_COPY_AND_ASSIGN(SearchEnginesPrivateEventRouterFactory);
  37. };
  38. } // namespace extensions
  39. #endif // CHROME_BROWSER_EXTENSIONS_API_SEARCH_ENGINES_PRIVATE_SEARCH_ENGINES_PRIVATE_EVENT_ROUTER_FACTORY_H_