This source file includes following definitions.
- GetInstance
- GetForProfile
- ServiceIsCreatedWithBrowserContext
- GetBrowserContextToUse
- ServiceIsNULLWhileTesting
- BuildServiceInstanceFor
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
#include "base/memory/singleton.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
ProtocolHandlerRegistryFactory* ProtocolHandlerRegistryFactory::GetInstance() {
return Singleton<ProtocolHandlerRegistryFactory>::get();
}
ProtocolHandlerRegistry* ProtocolHandlerRegistryFactory::GetForProfile(
Profile* profile) {
return static_cast<ProtocolHandlerRegistry*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
ProtocolHandlerRegistryFactory::ProtocolHandlerRegistryFactory()
: BrowserContextKeyedServiceFactory(
"ProtocolHandlerRegistry",
BrowserContextDependencyManager::GetInstance()) {
}
ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() {
}
bool
ProtocolHandlerRegistryFactory::ServiceIsCreatedWithBrowserContext() const {
return true;
}
content::BrowserContext* ProtocolHandlerRegistryFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const {
return true;
}
KeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry(
static_cast<Profile*>(profile), new ProtocolHandlerRegistry::Delegate());
#if defined(OS_CHROMEOS)
registry->InstallDefaultsForChromeOS();
#endif
registry->InitProtocolSettings();
return registry;
}