1 // Copyright (c) 2012 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.
5 #include "chrome/browser/predictors/autocomplete_action_predictor_factory.h"
7 #include "chrome/browser/history/history_service_factory.h"
8 #include "chrome/browser/predictors/autocomplete_action_predictor.h"
9 #include "chrome/browser/predictors/predictor_database_factory.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_dependency_manager.h"
14 namespace predictors
{
17 AutocompleteActionPredictor
* AutocompleteActionPredictorFactory::GetForProfile(
19 return static_cast<AutocompleteActionPredictor
*>(
20 GetInstance()->GetServiceForProfile(profile
, true));
24 AutocompleteActionPredictorFactory
*
25 AutocompleteActionPredictorFactory::GetInstance() {
26 return Singleton
<AutocompleteActionPredictorFactory
>::get();
29 AutocompleteActionPredictorFactory::AutocompleteActionPredictorFactory()
30 : ProfileKeyedServiceFactory("AutocompleteActionPredictor",
31 ProfileDependencyManager::GetInstance()) {
32 DependsOn(HistoryServiceFactory::GetInstance());
33 DependsOn(PredictorDatabaseFactory::GetInstance());
36 AutocompleteActionPredictorFactory::~AutocompleteActionPredictorFactory() {}
38 content::BrowserContext
*
39 AutocompleteActionPredictorFactory::GetBrowserContextToUse(
40 content::BrowserContext
* context
) const {
41 return chrome::GetBrowserContextOwnInstanceInIncognito(context
);
45 AutocompleteActionPredictorFactory::BuildServiceInstanceFor(
46 content::BrowserContext
* profile
) const {
47 return new AutocompleteActionPredictor(static_cast<Profile
*>(profile
));
50 } // namespace predictors