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 namespace { | |
16 | |
17 base::LazyInstance<MediaRouterMojoImplFactory> service_factory = | |
18 LAZY_INSTANCE_INITIALIZER; | |
19 | |
20 } // namespace | |
21 | |
22 // static | |
23 MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext( | |
24 BrowserContext* context) { | |
25 DCHECK(context); | |
26 | |
27 return static_cast<MediaRouterMojoImpl*>( | |
28 service_factory.Get().GetServiceForBrowserContext(context, true)); | |
29 } | |
30 | |
31 MediaRouterMojoImplFactory::MediaRouterMojoImplFactory() | |
32 : BrowserContextKeyedServiceFactory( | |
33 "MediaRouterMojoImpl", | |
34 BrowserContextDependencyManager::GetInstance()) { | |
35 // MediaRouterMojoImpl depends on ProcessManager. | |
36 DependsOn(extensions::ProcessManagerFactory::GetInstance()); | |
37 } | |
38 | |
39 MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() { | |
40 } | |
41 | |
42 KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor( | |
43 BrowserContext* context) const { | |
44 return new MediaRouterMojoImpl(); | |
45 } | |
46 | |
47 BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse( | |
48 BrowserContext* context) const { | |
49 // If |context| is incognito, use it instead of the original non-incognito | |
50 // BrowserContext. | |
xhwang
2015/05/28 06:53:21
I don't understand this comment. It seems we alway
imcheng (use chromium acct)
2015/05/28 20:46:35
I clarified the comments a bit. Let me know if it
xhwang
2015/05/28 22:08:09
Acknowledged.
| |
51 return context; | |
52 } | |
53 | |
54 } // namespace media_router | |
OLD | NEW |