| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/process_map_factory.h" | 5 #include "extensions/browser/process_map_factory.h" |
| 6 | 6 |
| 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 7 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 8 #include "extensions/browser/extensions_browser_client.h" | 8 #include "extensions/browser/extensions_browser_client.h" |
| 9 #include "extensions/browser/process_map.h" | 9 #include "extensions/browser/process_map.h" |
| 10 | 10 |
| 11 using content::BrowserContext; | 11 using content::BrowserContext; |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 // static | 15 // static |
| 16 ProcessMap* ProcessMapFactory::GetForBrowserContext(BrowserContext* context) { | 16 ProcessMap* ProcessMapFactory::GetForBrowserContext(BrowserContext* context) { |
| 17 return static_cast<ProcessMap*>( | 17 return static_cast<ProcessMap*>( |
| 18 GetInstance()->GetServiceForBrowserContext(context, true)); | 18 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 // static | 21 // static |
| 22 ProcessMapFactory* ProcessMapFactory::GetInstance() { | 22 ProcessMapFactory* ProcessMapFactory::GetInstance() { |
| 23 return Singleton<ProcessMapFactory>::get(); | 23 return base::Singleton<ProcessMapFactory>::get(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 ProcessMapFactory::ProcessMapFactory() | 26 ProcessMapFactory::ProcessMapFactory() |
| 27 : BrowserContextKeyedServiceFactory( | 27 : BrowserContextKeyedServiceFactory( |
| 28 "ProcessMap", | 28 "ProcessMap", |
| 29 BrowserContextDependencyManager::GetInstance()) { | 29 BrowserContextDependencyManager::GetInstance()) { |
| 30 // No dependencies on other services. | 30 // No dependencies on other services. |
| 31 } | 31 } |
| 32 | 32 |
| 33 ProcessMapFactory::~ProcessMapFactory() {} | 33 ProcessMapFactory::~ProcessMapFactory() {} |
| 34 | 34 |
| 35 KeyedService* ProcessMapFactory::BuildServiceInstanceFor( | 35 KeyedService* ProcessMapFactory::BuildServiceInstanceFor( |
| 36 BrowserContext* context) const { | 36 BrowserContext* context) const { |
| 37 return new ProcessMap; | 37 return new ProcessMap; |
| 38 } | 38 } |
| 39 | 39 |
| 40 BrowserContext* ProcessMapFactory::GetBrowserContextToUse( | 40 BrowserContext* ProcessMapFactory::GetBrowserContextToUse( |
| 41 BrowserContext* context) const { | 41 BrowserContext* context) const { |
| 42 // Redirected in incognito. | 42 // Redirected in incognito. |
| 43 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); | 43 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace extensions | 46 } // namespace extensions |
| OLD | NEW |