/chrome/browser/policy/networking/user_network_configuration_updater_factory.h

https://github.com/chromium/chromium · C Header · 60 lines · 36 code · 14 blank · 10 comment · 0 complexity · cc5e30c6ca57e74a3024b92378f8aed1 MD5 · raw file

  1. // Copyright 2013 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_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_FACTORY_H_
  5. #define CHROME_BROWSER_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_FACTORY_H_
  6. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  7. namespace base {
  8. template <typename T>
  9. struct DefaultSingletonTraits;
  10. } // namespace base
  11. namespace content {
  12. class BrowserContext;
  13. }
  14. namespace policy {
  15. class UserNetworkConfigurationUpdater;
  16. // Factory to create UserNetworkConfigurationUpdater for the the per-user
  17. // OpenNetworkConfiguration policy.
  18. class UserNetworkConfigurationUpdaterFactory
  19. : public BrowserContextKeyedServiceFactory {
  20. public:
  21. // Returns an existing or creates a new UserNetworkConfigurationUpdater for
  22. // |browser_context|. Will return nullptr if this service isn't allowed for
  23. // |browser_context|, i.e. for all but the BrowserContext which refers to the
  24. // primary user's profile.
  25. static UserNetworkConfigurationUpdater* GetForBrowserContext(
  26. content::BrowserContext* browser_context);
  27. static UserNetworkConfigurationUpdaterFactory* GetInstance();
  28. UserNetworkConfigurationUpdaterFactory(
  29. const UserNetworkConfigurationUpdaterFactory&) = delete;
  30. UserNetworkConfigurationUpdaterFactory& operator=(
  31. const UserNetworkConfigurationUpdaterFactory&) = delete;
  32. private:
  33. friend struct base::DefaultSingletonTraits<
  34. UserNetworkConfigurationUpdaterFactory>;
  35. UserNetworkConfigurationUpdaterFactory();
  36. ~UserNetworkConfigurationUpdaterFactory() override;
  37. // BrowserContextKeyedServiceFactory:
  38. content::BrowserContext* GetBrowserContextToUse(
  39. content::BrowserContext* context) const override;
  40. bool ServiceIsCreatedWithBrowserContext() const override;
  41. bool ServiceIsNULLWhileTesting() const override;
  42. KeyedService* BuildServiceInstanceFor(
  43. content::BrowserContext* context) const override;
  44. };
  45. } // namespace policy
  46. #endif // CHROME_BROWSER_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_FACTORY_H_