electron/shell/browser/badging/badge_manager_factory.cc
trop[bot] 748f293400
refactor: remove use of deprecated API BuildServiceInstanceFor() (#43707)
* refactor: update BadgeManagerFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update NetworkContextServiceFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update ElectronExtensionSystemFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update UsbChooserContextFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update UsbHidChooserContextFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update SerialChooserContextFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: update FileSystemAccessPermissionContextFactory

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* empty commit

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2024-09-13 15:26:10 -05:00

40 lines
1.2 KiB
C++

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "shell/browser/badging/badge_manager_factory.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "shell/browser/badging/badge_manager.h"
namespace badging {
// static
BadgeManager* BadgeManagerFactory::GetForBrowserContext(
content::BrowserContext* context) {
return static_cast<badging::BadgeManager*>(
GetInstance()->GetServiceForBrowserContext(context, true));
}
// static
BadgeManagerFactory* BadgeManagerFactory::GetInstance() {
static base::NoDestructor<BadgeManagerFactory> instance;
return instance.get();
}
BadgeManagerFactory::BadgeManagerFactory()
: BrowserContextKeyedServiceFactory(
"BadgeManager",
BrowserContextDependencyManager::GetInstance()) {}
BadgeManagerFactory::~BadgeManagerFactory() = default;
std::unique_ptr<KeyedService>
BadgeManagerFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const {
return std::make_unique<BadgeManager>();
}
} // namespace badging