Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / predictors / autocomplete_action_predictor_factory.cc
blobad3abdc0f736cabb890b56bfdacb7cf7f7985ca8
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 "components/keyed_service/content/browser_context_dependency_manager.h"
14 namespace predictors {
16 // static
17 AutocompleteActionPredictor* AutocompleteActionPredictorFactory::GetForProfile(
18 Profile* profile) {
19 return static_cast<AutocompleteActionPredictor*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
23 // static
24 AutocompleteActionPredictorFactory*
25 AutocompleteActionPredictorFactory::GetInstance() {
26 return Singleton<AutocompleteActionPredictorFactory>::get();
29 AutocompleteActionPredictorFactory::AutocompleteActionPredictorFactory()
30 : BrowserContextKeyedServiceFactory(
31 "AutocompleteActionPredictor",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(HistoryServiceFactory::GetInstance());
34 DependsOn(PredictorDatabaseFactory::GetInstance());
37 AutocompleteActionPredictorFactory::~AutocompleteActionPredictorFactory() {}
39 content::BrowserContext*
40 AutocompleteActionPredictorFactory::GetBrowserContextToUse(
41 content::BrowserContext* context) const {
42 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
45 KeyedService* AutocompleteActionPredictorFactory::BuildServiceInstanceFor(
46 content::BrowserContext* profile) const {
47 return new AutocompleteActionPredictor(static_cast<Profile*>(profile));
50 } // namespace predictors