OLD | NEW |
| (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 #ifndef COMPONENTS_CAST_CHANNEL_CAST_SOCKET_SERVICE_FACTORY_H_ | |
6 #define COMPONENTS_CAST_CHANNEL_CAST_SOCKET_SERVICE_FACTORY_H_ | |
7 | |
8 #include "base/lazy_instance.h" | |
9 #include "base/macros.h" | |
10 #include "components/keyed_service/content/refcounted_browser_context_keyed_serv
ice_factory.h" | |
11 | |
12 namespace cast_channel { | |
13 | |
14 class CastSocketService; | |
15 | |
16 // TODO(crbug.com/725717): CastSocket created by one profile (browser context) | |
17 // could be shared with other profiles. | |
18 class CastSocketServiceFactory | |
19 : public RefcountedBrowserContextKeyedServiceFactory { | |
20 public: | |
21 // Caller needs to make sure that it passes in the same |context| instance to | |
22 // this function for both normal profile and incognito profile. | |
23 static scoped_refptr<CastSocketService> GetForBrowserContext( | |
24 content::BrowserContext* context); | |
25 | |
26 static CastSocketServiceFactory* GetInstance(); | |
27 | |
28 private: | |
29 friend struct base::LazyInstanceTraitsBase<CastSocketServiceFactory>; | |
30 | |
31 CastSocketServiceFactory(); | |
32 ~CastSocketServiceFactory() override; | |
33 | |
34 // BrowserContextKeyedServiceFactory interface. | |
35 content::BrowserContext* GetBrowserContextToUse( | |
36 content::BrowserContext* context) const override; | |
37 | |
38 scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( | |
39 content::BrowserContext* context) const override; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(CastSocketServiceFactory); | |
42 }; | |
43 | |
44 } // namespace cast_channel | |
45 | |
46 #endif // COMPONENTS_CAST_CHANNEL_CAST_SOCKET_SERVICE_FACTORY_H_ | |
OLD | NEW |