2015-07-16 23:40:01 +02:00
|
|
|
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "libcef/browser/extensions/extension_system_factory.h"
|
|
|
|
|
|
|
|
#include "libcef/browser/extensions/extension_system.h"
|
|
|
|
|
2016-08-24 11:28:52 +02:00
|
|
|
#include "chrome/browser/profiles/incognito_helpers.h"
|
2015-07-16 23:40:01 +02:00
|
|
|
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
|
|
|
#include "extensions/browser/extension_prefs_factory.h"
|
|
|
|
#include "extensions/browser/extension_registry_factory.h"
|
|
|
|
|
|
|
|
using content::BrowserContext;
|
|
|
|
|
|
|
|
namespace extensions {
|
|
|
|
|
|
|
|
ExtensionSystem* CefExtensionSystemFactory::GetForBrowserContext(
|
|
|
|
BrowserContext* context) {
|
|
|
|
return static_cast<CefExtensionSystem*>(
|
|
|
|
GetInstance()->GetServiceForBrowserContext(context, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
|
|
|
CefExtensionSystemFactory* CefExtensionSystemFactory::GetInstance() {
|
2015-10-09 17:23:12 +02:00
|
|
|
return base::Singleton<CefExtensionSystemFactory>::get();
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CefExtensionSystemFactory::CefExtensionSystemFactory()
|
|
|
|
: ExtensionSystemProvider("CefExtensionSystem",
|
|
|
|
BrowserContextDependencyManager::GetInstance()) {
|
|
|
|
// Other factories that this factory depends on. See
|
|
|
|
// libcef/common/extensions/api/README.txt for additional details.
|
|
|
|
DependsOn(ExtensionPrefsFactory::GetInstance());
|
|
|
|
DependsOn(ExtensionRegistryFactory::GetInstance());
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
CefExtensionSystemFactory::~CefExtensionSystemFactory() {}
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2023-09-15 21:51:43 +02:00
|
|
|
std::unique_ptr<KeyedService>
|
|
|
|
CefExtensionSystemFactory::BuildServiceInstanceForBrowserContext(
|
2015-07-16 23:40:01 +02:00
|
|
|
BrowserContext* context) const {
|
2023-09-15 21:51:43 +02:00
|
|
|
return std::make_unique<CefExtensionSystem>(context);
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
BrowserContext* CefExtensionSystemFactory::GetBrowserContextToUse(
|
|
|
|
BrowserContext* context) const {
|
|
|
|
// Use a separate instance for incognito.
|
2016-08-24 11:28:52 +02:00
|
|
|
return chrome::GetBrowserContextOwnInstanceInIncognito(context);
|
2015-07-16 23:40:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefExtensionSystemFactory::ServiceIsCreatedWithBrowserContext() const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace extensions
|