Chromium Code Reviews| Index: chrome/browser/media/router/media_router_impl_factory.cc |
| diff --git a/chrome/browser/media/router/media_router_impl_factory.cc b/chrome/browser/media/router/media_router_impl_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f42cd93db3e6924e47dbba4c23bad496628509d9 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_router_impl_factory.cc |
| @@ -0,0 +1,47 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/media/router/media_router_impl_factory.h" |
| + |
| +#include "chrome/browser/media/router/media_router_impl.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| + |
| +using content::BrowserContext; |
| + |
| +namespace media_router { |
| + |
| +// static |
| +MediaRouterImpl* MediaRouterImplFactory::GetMediaRouterForBrowserContext( |
| + BrowserContext* context) { |
| + DCHECK(context); |
| + return static_cast<MediaRouterImpl*>( |
| + GetInstance()->GetServiceForBrowserContext(context, true)); |
| +} |
| + |
| +// static |
| +MediaRouterImplFactory* MediaRouterImplFactory::GetInstance() { |
| + return Singleton<MediaRouterImplFactory>::get(); |
| +} |
| + |
| +MediaRouterImplFactory::MediaRouterImplFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "MediaRouterImpl", |
| + BrowserContextDependencyManager::GetInstance()) { |
| +} |
| + |
| +MediaRouterImplFactory::~MediaRouterImplFactory() { |
| +} |
| + |
| +KeyedService* MediaRouterImplFactory::BuildServiceInstanceFor( |
| + BrowserContext* context) const { |
| + return new MediaRouterImpl; |
| +} |
| + |
| +BrowserContext* MediaRouterImplFactory::GetBrowserContextToUse( |
| + BrowserContext* context) const { |
| + // This means MediaRouterImpl is available in incongnito contexts as well. |
|
mark a. foltz
2015/03/31 22:10:24
incognito
imcheng
2015/04/01 00:55:16
Done.
|
| + return context; |
| +} |
| + |
| +} // namespace media_router |