This source file includes following definitions.
- GetForProfile
- GetInstance
- BuildInstanceFor
- GetBrowserContextToUse
- ServiceIsNULLWhileTesting
- BuildServiceInstanceFor
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
AutocompleteClassifier* AutocompleteClassifierFactory::GetForProfile(
Profile* profile) {
return static_cast<AutocompleteClassifier*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() {
return Singleton<AutocompleteClassifierFactory>::get();
}
KeyedService* AutocompleteClassifierFactory::BuildInstanceFor(
content::BrowserContext* profile) {
return new AutocompleteClassifier(static_cast<Profile*>(profile));
}
AutocompleteClassifierFactory::AutocompleteClassifierFactory()
: BrowserContextKeyedServiceFactory(
"AutocompleteClassifier",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(
extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
DependsOn(TemplateURLServiceFactory::GetInstance());
DependsOn(ShortcutsBackendFactory::GetInstance());
}
AutocompleteClassifierFactory::~AutocompleteClassifierFactory() {
}
content::BrowserContext* AutocompleteClassifierFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
bool AutocompleteClassifierFactory::ServiceIsNULLWhileTesting() const {
return true;
}
KeyedService* AutocompleteClassifierFactory::BuildServiceInstanceFor(
content::BrowserContext* profile) const {
return BuildInstanceFor(static_cast<Profile*>(profile));
}