| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 OffscreenPresentationManager* | 34 OffscreenPresentationManager* |
| 35 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( | 35 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( |
| 36 content::BrowserContext* context) { | 36 content::BrowserContext* context) { |
| 37 DCHECK(context); | 37 DCHECK(context); |
| 38 return static_cast<OffscreenPresentationManager*>( | 38 return static_cast<OffscreenPresentationManager*>( |
| 39 service_factory.Get().GetServiceForBrowserContext(context, true)); | 39 service_factory.Get().GetServiceForBrowserContext(context, true)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static |
| 43 OffscreenPresentationManagerFactory* |
| 44 OffscreenPresentationManagerFactory::GetInstanceForTest() { |
| 45 return &service_factory.Get(); |
| 46 } |
| 47 |
| 42 OffscreenPresentationManagerFactory::OffscreenPresentationManagerFactory() | 48 OffscreenPresentationManagerFactory::OffscreenPresentationManagerFactory() |
| 43 : BrowserContextKeyedServiceFactory( | 49 : BrowserContextKeyedServiceFactory( |
| 44 "OffscreenPresentationManager", | 50 "OffscreenPresentationManager", |
| 45 BrowserContextDependencyManager::GetInstance()) {} | 51 BrowserContextDependencyManager::GetInstance()) {} |
| 46 | 52 |
| 47 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} | 53 OffscreenPresentationManagerFactory::~OffscreenPresentationManagerFactory() {} |
| 48 | 54 |
| 49 content::BrowserContext* | 55 content::BrowserContext* |
| 50 OffscreenPresentationManagerFactory::GetBrowserContextToUse( | 56 OffscreenPresentationManagerFactory::GetBrowserContextToUse( |
| 51 content::BrowserContext* context) const { | 57 content::BrowserContext* context) const { |
| 52 return chrome::GetBrowserContextRedirectedInIncognito(context); | 58 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 53 } | 59 } |
| 54 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( | 60 KeyedService* OffscreenPresentationManagerFactory::BuildServiceInstanceFor( |
| 55 content::BrowserContext* context) const { | 61 content::BrowserContext* context) const { |
| 56 return new OffscreenPresentationManager; | 62 return new OffscreenPresentationManager; |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace media_router | 65 } // namespace media_router |
| OLD | NEW |