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(); | |
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.
| |
27 } | |
28 | |
29 MediaRouterMojoImplFactory::MediaRouterMojoImplFactory() | |
30 : BrowserContextKeyedServiceFactory( | |
31 "MediaRouterMojoImpl", | |
32 BrowserContextDependencyManager::GetInstance()) { | |
33 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.
| |
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. | |
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
| |
47 return context; | |
48 } | |
49 | |
50 } // namespace media_router | |
OLD | NEW |