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/media_router_mojo_impl_factory.h" |
| 6 |
| 7 #include "chrome/browser/media/router/media_router_mojo_impl.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "extensions/browser/process_manager_factory.h" |
| 10 |
| 11 using content::BrowserContext; |
| 12 |
| 13 namespace media_router { |
| 14 |
| 15 // static |
| 16 MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext( |
| 17 BrowserContext* context) { |
| 18 DCHECK(context); |
| 19 |
| 20 return static_cast<MediaRouterMojoImpl*>( |
| 21 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 22 } |
| 23 |
| 24 // static |
| 25 MediaRouterMojoImplFactory* MediaRouterMojoImplFactory::GetInstance() { |
| 26 return Singleton<MediaRouterMojoImplFactory>::get(); |
| 27 } |
| 28 |
| 29 MediaRouterMojoImplFactory::MediaRouterMojoImplFactory() |
| 30 : BrowserContextKeyedServiceFactory( |
| 31 "MediaRouterMojoImpl", |
| 32 BrowserContextDependencyManager::GetInstance()) { |
| 33 DependsOn(extensions::ProcessManagerFactory::GetInstance()); |
| 34 } |
| 35 |
| 36 MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() { |
| 37 } |
| 38 |
| 39 KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor( |
| 40 BrowserContext* context) const { |
| 41 return new MediaRouterMojoImpl(); |
| 42 } |
| 43 |
| 44 BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse( |
| 45 BrowserContext* context) const { |
| 46 // This means MediaRouterImpl is available in incongnito contexts as well. |
| 47 return context; |
| 48 } |
| 49 |
| 50 } // namespace media_router |
OLD | NEW |