1 // Copyright 2013 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/media/chrome_midi_permission_context_factory.h"
7 #include "chrome/browser/media/chrome_midi_permission_context.h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
13 ChromeMIDIPermissionContext
*
14 ChromeMIDIPermissionContextFactory::GetForProfile(Profile
* profile
) {
15 return static_cast<ChromeMIDIPermissionContext
*>(
16 GetInstance()->GetServiceForBrowserContext(profile
, true));
20 ChromeMIDIPermissionContextFactory
*
21 ChromeMIDIPermissionContextFactory::GetInstance() {
22 return Singleton
<ChromeMIDIPermissionContextFactory
>::get();
25 ChromeMIDIPermissionContextFactory::
26 ChromeMIDIPermissionContextFactory()
27 : BrowserContextKeyedServiceFactory(
28 "ChromeMIDIPermissionContext",
29 BrowserContextDependencyManager::GetInstance()) {
32 ChromeMIDIPermissionContextFactory::
33 ~ChromeMIDIPermissionContextFactory() {
36 BrowserContextKeyedService
*
37 ChromeMIDIPermissionContextFactory::BuildServiceInstanceFor(
38 content::BrowserContext
* profile
) const {
39 return new ChromeMIDIPermissionContext(static_cast<Profile
*>(profile
));
42 content::BrowserContext
*
43 ChromeMIDIPermissionContextFactory::GetBrowserContextToUse(
44 content::BrowserContext
* context
) const {
45 return chrome::GetBrowserContextOwnInstanceInIncognito(context
);