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 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} | 63 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} |
58 | 64 |
59 content::BrowserContext* | 65 content::BrowserContext* |
60 OffscreenPresentationManagerFactory::GetBrowserContextToUse( | 66 OffscreenPresentationManagerFactory::GetBrowserContextToUse( |
61 content::BrowserContext* context) const { | 67 content::BrowserContext* context) const { |
62 return chrome::GetBrowserContextRedirectedInIncognito(context); | 68 return chrome::GetBrowserContextRedirectedInIncognito(context); |
63 } | 69 } |
64 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( | 70 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( |
65 content::BrowserContext* context) const { | 71 content::BrowserContext* context) const { |
66 return new OffscreenPresentationManager; | 72 return new OffscreenPresentationManager; |
67 } | 73 } |
68 | 74 |
69 } // namespace media_router | 75 } // namespace media_router |
OLD | NEW |