OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" |
| 6 |
| 7 #include "base/lazy_instance.h" |
| 8 #include "chrome/browser/media/router/offscreen_presentation_manager.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 |
| 12 namespace media_router { |
| 13 |
| 14 namespace { |
| 15 |
| 16 base::LazyInstance<OffscreenPresentationManagerFactory> service_factory = |
| 17 LAZY_INSTANCE_INITIALIZER; |
| 18 |
| 19 } // namespace |
| 20 |
| 21 // static |
| 22 OffscreenPresentationManager* |
| 23 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| 24 content::BrowserContext* context) { |
| 25 DCHECK(context); |
| 26 return static_cast<OffscreenPresentationManager*>( |
| 27 service_factory.Get().GetServiceForBrowserContext(context, true)); |
| 28 } |
| 29 |
| 30 OffscreenPresentationManagerFactory::OffscreenPresentationManagerFactory() |
| 31 : BrowserContextKeyedServiceFactory( |
| 32 "OffscreenPresentationManager", |
| 33 BrowserContextDependencyManager::GetInstance()) {} |
| 34 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} |
| 35 |
| 36 content::BrowserContext* |
| 37 OffscreenPresentationManagerFactory::GetBrowserContextToUse( |
| 38 content::BrowserContext* context) const { |
| 39 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 40 } |
| 41 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( |
| 42 content::BrowserContext* context) const { |
| 43 return new OffscreenPresentationManager; |
| 44 } |
| 45 |
| 46 } // namespace media_router |
OLD | NEW |