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_impl.h" | |
8 #include "chrome/browser/media/router/media_router_impl_factory.h" | |
9 #include "chrome/browser/media/router/media_router_mojo_impl.h" | |
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
11 #include "extensions/browser/process_manager_factory.h" | |
12 | |
13 using content::BrowserContext; | |
14 | |
15 namespace media_router { | |
16 | |
17 // static | |
18 MediaRouterMojoImpl* MediaRouterMojoImplFactory::GetApiForBrowserContext( | |
19 BrowserContext* context) { | |
20 DCHECK(context); | |
21 | |
22 return static_cast<MediaRouterMojoImpl*>( | |
23 GetInstance()->GetServiceForBrowserContext(context, true)); | |
24 } | |
25 | |
26 // static | |
27 MediaRouterMojoImplFactory* MediaRouterMojoImplFactory::GetInstance() { | |
mark a. foltz
2015/05/08 00:58:38
Does this need to be a separate function, or just
Kevin M
2015/05/12 23:56:10
Done.
| |
28 return Singleton<MediaRouterMojoImplFactory>::get(); | |
29 } | |
30 | |
31 MediaRouterMojoImplFactory::MediaRouterMojoImplFactory() | |
32 : BrowserContextKeyedServiceFactory( | |
33 "MediaRouterMojoImpl", | |
34 BrowserContextDependencyManager::GetInstance()) { | |
35 DependsOn(extensions::ProcessManagerFactory::GetInstance()); | |
36 DependsOn(MediaRouterImplFactory::GetInstance()); | |
37 } | |
38 | |
39 MediaRouterMojoImplFactory::~MediaRouterMojoImplFactory() { | |
40 } | |
41 | |
42 KeyedService* MediaRouterMojoImplFactory::BuildServiceInstanceFor( | |
43 BrowserContext* context) const { | |
44 MediaRouterImpl* media_router = | |
45 MediaRouterImplFactory::GetMediaRouterForBrowserContext(context); | |
46 MediaRouterMojoImpl* api_impl = new MediaRouterMojoImpl(); | |
47 media_router->Initialize(api_impl); | |
48 return api_impl; | |
49 } | |
50 | |
51 BrowserContext* MediaRouterMojoImplFactory::GetBrowserContextToUse( | |
52 BrowserContext* context) const { | |
53 // This means MediaRouterImpl is available in incongnito contexts as well. | |
54 return context; | |
55 } | |
56 | |
57 } // namespace media_router | |
OLD | NEW |