OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" | 5 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 | 8 |
9 #include "chrome/browser/media/router/offscreen_presentation_manager.h" | 9 #include "chrome/browser/media/router/offscreen_presentation_manager.h" |
10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // static | 44 // static |
45 OffscreenPresentationManager* | 45 OffscreenPresentationManager* |
46 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( | 46 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
47 content::BrowserContext* context) { | 47 content::BrowserContext* context) { |
48 DCHECK(context); | 48 DCHECK(context); |
49 return static_cast<OffscreenPresentationManager*>( | 49 return static_cast<OffscreenPresentationManager*>( |
50 service_factory.Get().GetServiceForBrowserContext(context, true)); | 50 service_factory.Get().GetServiceForBrowserContext(context, true)); |
51 } | 51 } |
52 | 52 |
| 53 // static |
| 54 OffscreenPresentationManagerFactory* |
| 55 OffscreenPresentationManagerFactory::GetInstanceForTest() { |
| 56 return &service_factory.Get(); |
| 57 } |
| 58 |
53 OffscreenPresentationManagerFactory::OffscreenPresentationManagerFactory() | 59 OffscreenPresentationManagerFactory::OffscreenPresentationManagerFactory() |
54 : BrowserContextKeyedServiceFactory( | 60 : BrowserContextKeyedServiceFactory( |
55 "OffscreenPresentationManager", | 61 "OffscreenPresentationManager", |
56 BrowserContextDependencyManager::GetInstance()) {} | 62 BrowserContextDependencyManager::GetInstance()) {} |
57 | 63 |
58 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} | 64 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} |
59 | 65 |
60 content::BrowserContext* | 66 content::BrowserContext* |
61 OffscreenPresentationManagerFactory::GetBrowserContextToUse( | 67 OffscreenPresentationManagerFactory::GetBrowserContextToUse( |
62 content::BrowserContext* context) const { | 68 content::BrowserContext* context) const { |
63 return chrome::GetBrowserContextRedirectedInIncognito(context); | 69 return chrome::GetBrowserContextRedirectedInIncognito(context); |
64 } | 70 } |
65 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( | 71 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( |
66 content::BrowserContext* context) const { | 72 content::BrowserContext* context) const { |
67 return new OffscreenPresentationManager; | 73 return new OffscreenPresentationManager; |
68 } | 74 } |
69 | 75 |
70 } // namespace media_router | 76 } // namespace media_router |
OLD | NEW |