Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: chrome/browser/media/router/media_router_mojo_impl_factory.cc

Issue 1143603004: [Media Router] Add Media Router Mojo impl code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Xiaohan's comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Always use the input context. This means that an incognito context will
50 // have its own MediaRouterMojoImpl service, rather than sharing it with its
51 // original non-incognito context.
52 return context;
53 }
54
55 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698