weblayer_bluetooth_chooser_context_factory.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2021 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 WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_CHOOSER_CONTEXT_FACTORY_H_
  5. #define WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_CHOOSER_CONTEXT_FACTORY_H_
  6. #include "base/no_destructor.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. namespace permissions {
  9. class BluetoothChooserContext;
  10. }
  11. namespace weblayer {
  12. class WebLayerBluetoothChooserContextFactory
  13. : public BrowserContextKeyedServiceFactory {
  14. public:
  15. static permissions::BluetoothChooserContext* GetForBrowserContext(
  16. content::BrowserContext* context);
  17. static permissions::BluetoothChooserContext* GetForBrowserContextIfExists(
  18. content::BrowserContext* context);
  19. static WebLayerBluetoothChooserContextFactory* GetInstance();
  20. WebLayerBluetoothChooserContextFactory(
  21. const WebLayerBluetoothChooserContextFactory&) = delete;
  22. WebLayerBluetoothChooserContextFactory& operator=(
  23. const WebLayerBluetoothChooserContextFactory&) = delete;
  24. private:
  25. friend base::NoDestructor<WebLayerBluetoothChooserContextFactory>;
  26. WebLayerBluetoothChooserContextFactory();
  27. ~WebLayerBluetoothChooserContextFactory() override;
  28. // BrowserContextKeyedServiceFactory implementation:
  29. KeyedService* BuildServiceInstanceFor(
  30. content::BrowserContext* context) const override;
  31. content::BrowserContext* GetBrowserContextToUse(
  32. content::BrowserContext* context) const override;
  33. void BrowserContextShutdown(content::BrowserContext* context) override;
  34. };
  35. } // namespace weblayer
  36. #endif // WEBLAYER_BROWSER_BLUETOOTH_WEBLAYER_BLUETOOTH_CHOOSER_CONTEXT_FACTORY_H_