OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "extensions/browser/api/display_source/display_source_event_router_fact
ory.h" |
| 6 |
| 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 8 #include "content/public/browser/browser_context.h" |
| 9 #include "extensions/browser/api/display_source/display_source_connection_delega
te_factory.h" |
| 10 #include "extensions/browser/api/display_source/display_source_event_router.h" |
| 11 #include "extensions/browser/extension_system_provider.h" |
| 12 #include "extensions/browser/extensions_browser_client.h" |
| 13 |
| 14 namespace extensions { |
| 15 |
| 16 // static |
| 17 DisplaySourceEventRouter* DisplaySourceEventRouterFactory::GetForProfile( |
| 18 content::BrowserContext* context) { |
| 19 return static_cast<DisplaySourceEventRouter*>( |
| 20 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 21 } |
| 22 |
| 23 // static |
| 24 DisplaySourceEventRouterFactory* |
| 25 DisplaySourceEventRouterFactory::GetInstance() { |
| 26 return base::Singleton<DisplaySourceEventRouterFactory>::get(); |
| 27 } |
| 28 |
| 29 DisplaySourceEventRouterFactory::DisplaySourceEventRouterFactory() |
| 30 : BrowserContextKeyedServiceFactory( |
| 31 "DisplaySourceEventRouter", |
| 32 BrowserContextDependencyManager::GetInstance()) { |
| 33 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 34 DependsOn(DisplaySourceConnectionDelegateFactory::GetInstance()); |
| 35 } |
| 36 |
| 37 DisplaySourceEventRouterFactory::~DisplaySourceEventRouterFactory() {} |
| 38 |
| 39 KeyedService* DisplaySourceEventRouterFactory::BuildServiceInstanceFor( |
| 40 content::BrowserContext* context) const { |
| 41 return DisplaySourceEventRouter::Create(context); |
| 42 } |
| 43 |
| 44 content::BrowserContext* |
| 45 DisplaySourceEventRouterFactory::GetBrowserContextToUse( |
| 46 content::BrowserContext* context) const { |
| 47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 48 } |
| 49 |
| 50 bool DisplaySourceEventRouterFactory::ServiceIsCreatedWithBrowserContext() |
| 51 const { |
| 52 return true; |
| 53 } |
| 54 |
| 55 bool DisplaySourceEventRouterFactory::ServiceIsNULLWhileTesting() const { |
| 56 return true; |
| 57 } |
| 58 |
| 59 } // namespace extensions |
OLD | NEW |