blob: ceaf7a316b165e632619f097e111ebad15c3aca9 [file] [log] [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/badging/badge_manager_factory.h"
#include <memory>
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "chrome/browser/badging/badge_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/web_app_provider_factory.h"
#include "components/prefs/pref_service.h"
namespace badging {
// static
BadgeManager* BadgeManagerFactory::GetForProfile(Profile* profile) {
return static_cast<badging::BadgeManager*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
// static
BadgeManagerFactory* BadgeManagerFactory::GetInstance() {
return base::Singleton<BadgeManagerFactory>::get();
}
BadgeManagerFactory::BadgeManagerFactory()
: ProfileKeyedServiceFactory("BadgeManager") {
DependsOn(web_app::WebAppProviderFactory::GetInstance());
}
BadgeManagerFactory::~BadgeManagerFactory() {}
KeyedService* BadgeManagerFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new BadgeManager(Profile::FromBrowserContext(context));
}
} // namespace badging