refactor: remove use of deprecated API BuildServiceInstanceFor() (31-x-y) (#43782)

refactor: remove use of deprecated API BuildServiceInstanceFor() (#43690)

* refactor: update BadgeManagerFactory

* refactor: update NetworkContextServiceFactory

* refactor: update ElectronExtensionSystemFactory

* refactor: update UsbChooserContextFactory

* refactor: update UsbHidChooserContextFactory

* refactor: update SerialChooserContextFactory

* refactor: update FileSystemAccessPermissionContextFactory
This commit is contained in:
Charles Kerr 2024-09-19 03:01:00 -05:00 committed by GitHub
parent e62c322b2d
commit 48805ee46e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 43 additions and 38 deletions

View file

@ -37,11 +37,11 @@ HidChooserContextFactory::HidChooserContextFactory()
HidChooserContextFactory::~HidChooserContextFactory() = default;
KeyedService* HidChooserContextFactory::BuildServiceInstanceFor(
std::unique_ptr<KeyedService>
HidChooserContextFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const {
auto* browser_context =
static_cast<electron::ElectronBrowserContext*>(context);
return new HidChooserContext(browser_context);
return std::make_unique<HidChooserContext>(
static_cast<electron::ElectronBrowserContext*>(context));
}
content::BrowserContext* HidChooserContextFactory::GetBrowserContextToUse(

View file

@ -5,6 +5,8 @@
#ifndef ELECTRON_SHELL_BROWSER_HID_HID_CHOOSER_CONTEXT_FACTORY_H_
#define ELECTRON_SHELL_BROWSER_HID_HID_CHOOSER_CONTEXT_FACTORY_H_
#include <memory>
#include "base/no_destructor.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
@ -30,8 +32,8 @@ class HidChooserContextFactory : public BrowserContextKeyedServiceFactory {
HidChooserContextFactory();
~HidChooserContextFactory() override;
// BrowserContextKeyedBaseFactory:
KeyedService* BuildServiceInstanceFor(
// BrowserContextKeyedServiceFactory:
std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext(
content::BrowserContext* profile) const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;