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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_service_factory.cc

Issue 2891023002: [cast_channel] Make CastSocket not inherit from ApiResource (Closed)
Patch Set: Created 3 years, 7 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 2017 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 "extensions/browser/api/cast_channel/cast_channel_service_factory.h"
6
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/api/cast_channel/cast_channel_service.h"
9
10 namespace extensions {
11 namespace api {
12 namespace cast_channel {
13
14 using content::BrowserContext;
15
16 namespace {
17
18 base::LazyInstance<CastChannelServiceFactory>::DestructorAtExit
19 service_factory = LAZY_INSTANCE_INITIALIZER;
20 } // namespace
21
22 // static
23 CastChannelService* CastChannelServiceFactory::GetForBrowserContext(
24 BrowserContext* context) {
25 DCHECK(context);
26 // GetServiceForBrowserContext returns a KeyedService hence the static_cast<>
27 // to return a pointer to CastChannelService.
28 return static_cast<CastChannelService*>(
29 service_factory.Get().GetServiceForBrowserContext(context, true));
30 }
31
32 // static
33 CastChannelServiceFactory* CastChannelServiceFactory::GetInstance() {
34 return &service_factory.Get();
35 }
36
37 CastChannelServiceFactory::CastChannelServiceFactory()
38 : BrowserContextKeyedServiceFactory(
39 "CastChannelService",
40 BrowserContextDependencyManager::GetInstance()) {}
41
42 CastChannelServiceFactory::~CastChannelServiceFactory() {}
43
44 content::BrowserContext* CastChannelServiceFactory::GetBrowserContextToUse(
45 content::BrowserContext* context) const {
46 return context;
mark a. foltz 2017/05/18 19:12:05 This will return separate services for a normal pr
zhaobin 2017/05/24 01:51:40 Verified that CastChannelAPI has the same browser
mark a. foltz 2017/05/24 17:44:10 Cool :)
47 }
48
49 KeyedService* CastChannelServiceFactory::BuildServiceInstanceFor(
50 BrowserContext* context) const {
51 return new CastChannelService();
52 }
53
54 } // namespace cast_channel
55 } // namespace api
56 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698