[Presentation API, Android] Implement basic messaging
[chromium-blink-merge.git] / chrome / browser / notifications / notification_permission_context_factory.cc
blob08e3d0b1965eb76b5de6704549a91bc947baca20
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/notifications/notification_permission_context_factory.h"
7 #include "chrome/browser/notifications/notification_permission_context.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 // static
13 NotificationPermissionContext*
14 NotificationPermissionContextFactory::GetForProfile(Profile* profile) {
15 return static_cast<NotificationPermissionContext*>(
16 GetInstance()->GetServiceForBrowserContext(profile, true));
19 // static
20 NotificationPermissionContextFactory*
21 NotificationPermissionContextFactory::GetInstance() {
22 return Singleton<NotificationPermissionContextFactory>::get();
25 NotificationPermissionContextFactory::NotificationPermissionContextFactory()
26 : BrowserContextKeyedServiceFactory(
27 "NotificationPermissionContext",
28 BrowserContextDependencyManager::GetInstance()) {}
30 NotificationPermissionContextFactory::~NotificationPermissionContextFactory() {}
32 KeyedService* NotificationPermissionContextFactory::BuildServiceInstanceFor(
33 content::BrowserContext* profile) const {
34 return new NotificationPermissionContext(static_cast<Profile*>(profile));
37 content::BrowserContext*
38 NotificationPermissionContextFactory::GetBrowserContextToUse(
39 content::BrowserContext* context) const {
40 return chrome::GetBrowserContextOwnInstanceInIncognito(context);