Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: chrome/browser/predictors/loading_predictor_factory.cc

Issue 2847183002: predictors: Introduce GlowplugPredictor. (Closed)
Patch Set: GlowplugPredictor -> LoadingPredictor Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 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.
4
5 #include "chrome/browser/predictors/loading_predictor_factory.h"
6
7 #include "chrome/browser/history/history_service_factory.h"
8 #include "chrome/browser/predictors/loading_predictor.h"
9 #include "chrome/browser/predictors/predictor_database_factory.h"
10 #include "chrome/browser/predictors/resource_prefetch_common.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
14
15 namespace predictors {
16
17 // static
18 LoadingPredictor* LoadingPredictorFactory::GetForProfile(Profile* profile) {
19 return static_cast<LoadingPredictor*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
21 }
22
23 // static
24 LoadingPredictorFactory* LoadingPredictorFactory::GetInstance() {
25 return base::Singleton<LoadingPredictorFactory>::get();
26 }
27
28 LoadingPredictorFactory::LoadingPredictorFactory()
29 : BrowserContextKeyedServiceFactory(
30 "LoadingPredictor",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(HistoryServiceFactory::GetInstance());
33 DependsOn(PredictorDatabaseFactory::GetInstance());
34 }
35
36 LoadingPredictorFactory::~LoadingPredictorFactory() {}
37
38 KeyedService* LoadingPredictorFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const {
40 Profile* profile = Profile::FromBrowserContext(context);
41
42 LoadingPredictorConfig config;
43 if (!IsLoadingPredictortEnabled(profile, &config))
44 return nullptr;
45
46 return new LoadingPredictor(config, profile);
47 }
48
49 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/loading_predictor_factory.h ('k') | chrome/browser/predictors/predictor_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698