| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 9 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 class BrowserContext; | 12 class BrowserContext; |
| 13 } | 13 } |
| 14 | 14 |
| 15 namespace media_router { | 15 namespace media_router { |
| 16 | 16 |
| 17 class MediaRouterUIService; | 17 class MediaRouterUIService; |
| 18 | 18 |
| 19 class MediaRouterUIServiceFactory : public BrowserContextKeyedServiceFactory { | 19 class MediaRouterUIServiceFactory : public BrowserContextKeyedServiceFactory { |
| 20 public: | 20 public: |
| 21 static MediaRouterUIService* GetForBrowserContext( | 21 static MediaRouterUIService* GetForBrowserContext( |
| 22 content::BrowserContext* context); | 22 content::BrowserContext* context); |
| 23 | 23 |
| 24 static MediaRouterUIServiceFactory* GetInstance(); | 24 static MediaRouterUIServiceFactory* GetInstance(); |
| 25 | 25 |
| 26 // By default, this factory returns a NULL service for TestingBrowserContext. |
| 27 // Call this method to make it return a non-NULL service. |
| 28 static void SetUseInTests(); |
| 29 |
| 26 private: | 30 private: |
| 27 friend struct base::DefaultSingletonTraits<MediaRouterUIServiceFactory>; | 31 friend struct base::DefaultSingletonTraits<MediaRouterUIServiceFactory>; |
| 28 | 32 |
| 29 MediaRouterUIServiceFactory(); | 33 MediaRouterUIServiceFactory(); |
| 30 ~MediaRouterUIServiceFactory() override; | 34 ~MediaRouterUIServiceFactory() override; |
| 31 | 35 |
| 32 // BrowserContextKeyedServiceFactory interface. | 36 // BrowserContextKeyedServiceFactory interface. |
| 33 content::BrowserContext* GetBrowserContextToUse( | 37 content::BrowserContext* GetBrowserContextToUse( |
| 34 content::BrowserContext* context) const override; | 38 content::BrowserContext* context) const override; |
| 35 KeyedService* BuildServiceInstanceFor( | 39 KeyedService* BuildServiceInstanceFor( |
| 36 content::BrowserContext* context) const override; | 40 content::BrowserContext* context) const override; |
| 41 bool ServiceIsCreatedWithBrowserContext() const override; |
| 42 bool ServiceIsNULLWhileTesting() const override; |
| 37 | 43 |
| 38 DISALLOW_COPY_AND_ASSIGN(MediaRouterUIServiceFactory); | 44 DISALLOW_COPY_AND_ASSIGN(MediaRouterUIServiceFactory); |
| 39 }; | 45 }; |
| 40 | 46 |
| 41 } // namespace media_router | 47 } // namespace media_router |
| 42 | 48 |
| 43 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ | 49 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_UI_SERVICE_FACTORY_H_ |
| OLD | NEW |