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