From 2e9909083850d6a4242334557510be97e34acb04 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Wed, 23 Aug 2023 19:22:04 +0000 Subject: [PATCH] Implement the non-deprecated builder. Any class inheriting `BrowserContextKeyedServiceFactory` should implement either `BuildServiceInstanceForBrowserContext` or `BuildServiceInstanceFor`. The second one was deprecated, this CL replaces it with the first one. Bug: 1396138 Change-Id: Iece7ebb503b4212f9d703fa8f26dcf88d4e84383 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4798401 Commit-Queue: Devlin Cronin Auto-Submit: Arthur Milchior Reviewed-by: Devlin Cronin Cr-Commit-Position: refs/heads/main@{#1187422} --- extensions/browser/warning_service_factory.cc | 5 +++-- extensions/browser/warning_service_factory.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/browser/warning_service_factory.cc b/extensions/browser/warning_service_factory.cc index 7efc2a9230777e..345157c0627107 100644 --- a/extensions/browser/warning_service_factory.cc +++ b/extensions/browser/warning_service_factory.cc @@ -35,9 +35,10 @@ WarningServiceFactory::WarningServiceFactory() WarningServiceFactory::~WarningServiceFactory() { } -KeyedService* WarningServiceFactory::BuildServiceInstanceFor( +std::unique_ptr +WarningServiceFactory::BuildServiceInstanceForBrowserContext( BrowserContext* context) const { - return new WarningService(context); + return std::make_unique(context); } BrowserContext* WarningServiceFactory::GetBrowserContextToUse( diff --git a/extensions/browser/warning_service_factory.h b/extensions/browser/warning_service_factory.h index 1de59d7b88ca09..272a74fc1ff63b 100644 --- a/extensions/browser/warning_service_factory.h +++ b/extensions/browser/warning_service_factory.h @@ -27,7 +27,7 @@ class WarningServiceFactory : public BrowserContextKeyedServiceFactory { ~WarningServiceFactory() override; // BrowserContextKeyedServiceFactory implementation - KeyedService* BuildServiceInstanceFor( + std::unique_ptr BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const override; content::BrowserContext* GetBrowserContextToUse( content::BrowserContext* context) const override;