Chromium Code Reviews| Index: chrome/browser/media/router/media_router_mojo_impl_factory.cc |
| diff --git a/chrome/browser/media/router/media_router_mojo_impl_factory.cc b/chrome/browser/media/router/media_router_mojo_impl_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1ba2d9bbbd2ee81943a94c95be39b39e64aee29 |
| --- /dev/null |
| +++ b/chrome/browser/media/router/media_router_mojo_impl_factory.cc |
| @@ -0,0 +1,50 @@ |
| +// 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_mojo_impl_factory.h" |
| + |
| +#include "chrome/browser/media/router/media_router_mojo_impl.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| +#include "extensions/browser/process_manager_factory.h" |
| + |
| +using content::BrowserContext; |
| + |
| +namespace media_router { |
| + |
| +// static |
| +MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext( |
| + BrowserContext* context) { |
| + DCHECK(context); |
| + |
| + return static_cast<MediaRouterMojoImpl*>( |
| + GetInstance()->GetServiceForBrowserContext(context, true)); |
| +} |
| + |
| +// static |
| +MediaRouterMojoImplFactory* MediaRouterMojoImplFactory::GetInstance() { |
| + return Singleton<MediaRouterMojoImplFactory>::get(); |
|
Wez
2015/05/20 23:37:49
I'm not familiar with this pattern; is this the pr
imcheng (use chromium acct)
2015/05/21 19:28:52
Done.
|
| +} |
| + |
| +MediaRouterMojoImplFactory::MediaRouterMojoImplFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "MediaRouterMojoImpl", |
| + BrowserContextDependencyManager::GetInstance()) { |
| + DependsOn(extensions::ProcessManagerFactory::GetInstance()); |
|
Wez
2015/05/20 23:37:49
nit: Consider documenting why we depend on this, s
imcheng (use chromium acct)
2015/05/21 19:28:52
Done.
|
| +} |
| + |
| +MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() { |
| +} |
| + |
| +KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor( |
| + BrowserContext* context) const { |
| + return new MediaRouterMojoImpl(); |
| +} |
| + |
| +BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse( |
| + BrowserContext* context) const { |
| + // This means MediaRouterImpl is available in incongnito contexts as well. |
|
Wez
2015/05/20 23:37:50
typo: Incognito
This comment doesn't make clear w
imcheng (use chromium acct)
2015/05/21 19:28:52
I tried to clarified the comment. It just means we
|
| + return context; |
| +} |
| + |
| +} // namespace media_router |