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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" 5 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
6 6
7 #include "chrome/browser/history/history_service_factory.h" 7 #include "chrome/browser/history/history_service_factory.h"
8 #include "chrome/browser/predictors/predictor_database_factory.h" 8 #include "chrome/browser/predictors/predictor_database_factory.h"
9 #include "chrome/browser/predictors/resource_prefetch_common.h" 9 #include "chrome/browser/predictors/resource_prefetch_common.h"
10 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 10 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 13 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
14 14
15 namespace predictors { 15 namespace predictors {
16 16
17 // static 17 // static
18 ResourcePrefetchPredictor* ResourcePrefetchPredictorFactory::GetForProfile( 18 ResourcePrefetchPredictor* ResourcePrefetchPredictorFactory::GetForProfile(
19 content::BrowserContext* context) { 19 content::BrowserContext* context) {
20 return static_cast<ResourcePrefetchPredictor*>( 20 return static_cast<ResourcePrefetchPredictor*>(
21 GetInstance()->GetServiceForBrowserContext(context, true)); 21 GetInstance()->GetServiceForBrowserContext(context, true));
22 } 22 }
23 23
24 // static 24 // static
25 ResourcePrefetchPredictorFactory* 25 ResourcePrefetchPredictorFactory*
26 ResourcePrefetchPredictorFactory::GetInstance() { 26 ResourcePrefetchPredictorFactory::GetInstance() {
27 return Singleton<ResourcePrefetchPredictorFactory>::get(); 27 return base::Singleton<ResourcePrefetchPredictorFactory>::get();
28 } 28 }
29 29
30 ResourcePrefetchPredictorFactory::ResourcePrefetchPredictorFactory() 30 ResourcePrefetchPredictorFactory::ResourcePrefetchPredictorFactory()
31 : BrowserContextKeyedServiceFactory( 31 : BrowserContextKeyedServiceFactory(
32 "ResourcePrefetchPredictor", 32 "ResourcePrefetchPredictor",
33 BrowserContextDependencyManager::GetInstance()) { 33 BrowserContextDependencyManager::GetInstance()) {
34 DependsOn(HistoryServiceFactory::GetInstance()); 34 DependsOn(HistoryServiceFactory::GetInstance());
35 DependsOn(PredictorDatabaseFactory::GetInstance()); 35 DependsOn(PredictorDatabaseFactory::GetInstance());
36 } 36 }
37 37
38 ResourcePrefetchPredictorFactory::~ResourcePrefetchPredictorFactory() {} 38 ResourcePrefetchPredictorFactory::~ResourcePrefetchPredictorFactory() {}
39 39
40 KeyedService* 40 KeyedService*
41 ResourcePrefetchPredictorFactory::BuildServiceInstanceFor( 41 ResourcePrefetchPredictorFactory::BuildServiceInstanceFor(
42 content::BrowserContext* context) const { 42 content::BrowserContext* context) const {
43 Profile* profile = Profile::FromBrowserContext(context); 43 Profile* profile = Profile::FromBrowserContext(context);
44 44
45 ResourcePrefetchPredictorConfig config; 45 ResourcePrefetchPredictorConfig config;
46 if (!IsSpeculativeResourcePrefetchingEnabled(profile, &config)) 46 if (!IsSpeculativeResourcePrefetchingEnabled(profile, &config))
47 return NULL; 47 return NULL;
48 48
49 return new ResourcePrefetchPredictor(config, profile); 49 return new ResourcePrefetchPredictor(config, profile);
50 } 50 }
51 51
52 } // namespace predictors 52 } // namespace predictors
OLDNEW
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_predictor_factory.h ('k') | chrome/browser/prefs/incognito_mode_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698