0

Implements the non-deprecated builder.

Any class inheriting `BrowserContextKeyedServiceFactory` should
implements either `BuildServiceInstanceForBrowserContext` or
`BuildServiceInstanceFor`. The second one being deprecated, this CL
replaces it by the first one.

This also ensures that, instead of applying `WrapUnique` to a `new`
raw ptr, it directly uses `make_unique`.

Change-Id: I137d7eeb95500a85606e540097819e9d8b128cf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4797890
Auto-Submit: Arthur Milchior <arthurmilchior@chromium.org>
Commit-Queue: Arthur Milchior <arthurmilchior@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1186152}
This commit is contained in:
Arthur Milchior
2023-08-21 23:37:34 +00:00
committed by Chromium LUCI CQ
parent 82c75453c1
commit e3e86dea8c
2 changed files with 4 additions and 3 deletions

@ -32,9 +32,10 @@ AppRestoreServiceFactory::AppRestoreServiceFactory()
AppRestoreServiceFactory::~AppRestoreServiceFactory() = default;
KeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
std::unique_ptr<KeyedService>
AppRestoreServiceFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const {
return new AppRestoreService(context);
return std::make_unique<AppRestoreService>(context);
}
bool AppRestoreServiceFactory::ServiceIsCreatedWithBrowserContext() const {

@ -34,7 +34,7 @@ class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory {
~AppRestoreServiceFactory() override;
// BrowserContextKeyedServiceFactory:
KeyedService* BuildServiceInstanceFor(
std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
content::BrowserContext* GetBrowserContextToUse(