fix: enable navigator.setAppBadge/clearAppBadge (#27067)
This commit is contained in:
parent
8b74361b0c
commit
c5a41defbd
19 changed files with 481 additions and 41 deletions
41
shell/browser/badging/badge_manager_factory.cc
Normal file
41
shell/browser/badging/badge_manager_factory.cc
Normal file
|
@ -0,0 +1,41 @@
|
|||
// 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 <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/singleton.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() {
|
||||
return base::Singleton<BadgeManagerFactory>::get();
|
||||
}
|
||||
|
||||
BadgeManagerFactory::BadgeManagerFactory()
|
||||
: BrowserContextKeyedServiceFactory(
|
||||
"BadgeManager",
|
||||
BrowserContextDependencyManager::GetInstance()) {}
|
||||
|
||||
BadgeManagerFactory::~BadgeManagerFactory() {}
|
||||
|
||||
KeyedService* BadgeManagerFactory::BuildServiceInstanceFor(
|
||||
content::BrowserContext* context) const {
|
||||
return new BadgeManager();
|
||||
}
|
||||
|
||||
} // namespace badging
|
Loading…
Add table
Add a link
Reference in a new issue