2022-11-22 21:50:32 +00:00
|
|
|
// Copyright (c) 2022 Microsoft, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTEXT_FACTORY_H_
|
|
|
|
#define ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTEXT_FACTORY_H_
|
|
|
|
|
2024-09-12 20:44:14 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2022-11-22 21:50:32 +00:00
|
|
|
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
|
|
|
|
|
2024-02-23 09:35:20 +00:00
|
|
|
namespace base {
|
|
|
|
template <typename T>
|
|
|
|
class NoDestructor;
|
|
|
|
} // namespace base
|
|
|
|
|
2022-11-22 21:50:32 +00:00
|
|
|
namespace electron {
|
|
|
|
|
|
|
|
class UsbChooserContext;
|
|
|
|
|
|
|
|
class UsbChooserContextFactory : public BrowserContextKeyedServiceFactory {
|
|
|
|
public:
|
|
|
|
static UsbChooserContext* GetForBrowserContext(
|
|
|
|
content::BrowserContext* context);
|
|
|
|
static UsbChooserContext* GetForBrowserContextIfExists(
|
|
|
|
content::BrowserContext* context);
|
|
|
|
static UsbChooserContextFactory* GetInstance();
|
|
|
|
|
|
|
|
UsbChooserContextFactory(const UsbChooserContextFactory&) = delete;
|
|
|
|
UsbChooserContextFactory& operator=(const UsbChooserContextFactory&) = delete;
|
|
|
|
|
|
|
|
private:
|
2024-02-23 09:35:20 +00:00
|
|
|
friend base::NoDestructor<UsbChooserContextFactory>;
|
2022-11-22 21:50:32 +00:00
|
|
|
|
|
|
|
UsbChooserContextFactory();
|
|
|
|
~UsbChooserContextFactory() override;
|
|
|
|
|
|
|
|
// BrowserContextKeyedServiceFactory methods:
|
2024-09-12 20:44:14 +00:00
|
|
|
std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext(
|
2022-11-22 21:50:32 +00:00
|
|
|
content::BrowserContext* profile) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace electron
|
|
|
|
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_USB_USB_CHOOSER_CONTEXT_FACTORY_H_
|