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