OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/instant/instant_service_factory.h" | 5 #include "chrome/browser/instant/instant_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/instant/instant_service.h" | 7 #include "chrome/browser/instant/instant_service.h" |
8 #include "chrome/browser/profiles/profile_dependency_manager.h" | 8 #include "chrome/browser/profiles/profile_dependency_manager.h" |
9 | 9 |
10 // static | 10 // static |
11 InstantService* InstantServiceFactory::GetForProfile(Profile* profile) { | 11 InstantService* InstantServiceFactory::GetForProfile(Profile* profile) { |
12 return static_cast<InstantService*>( | 12 return static_cast<InstantService*>( |
13 GetInstance()->GetServiceForProfile(profile, true)); | 13 GetInstance()->GetServiceForProfile(profile, true)); |
14 } | 14 } |
15 | 15 |
16 // static | 16 // static |
17 InstantServiceFactory* InstantServiceFactory::GetInstance() { | 17 InstantServiceFactory* InstantServiceFactory::GetInstance() { |
18 return Singleton<InstantServiceFactory>::get(); | 18 return Singleton<InstantServiceFactory>::get(); |
19 } | 19 } |
20 | 20 |
21 // static | |
22 ProfileKeyedService* InstantServiceFactory::BuildInstanceFor(Profile* profile) { | |
23 return new InstantService; | |
24 } | |
25 | |
26 InstantServiceFactory::InstantServiceFactory() | 21 InstantServiceFactory::InstantServiceFactory() |
27 : ProfileKeyedServiceFactory("InstantService", | 22 : ProfileKeyedServiceFactory("InstantService", |
28 ProfileDependencyManager::GetInstance()) { | 23 ProfileDependencyManager::GetInstance()) { |
29 // No dependencies. | 24 // No dependencies. |
30 } | 25 } |
31 | 26 |
32 InstantServiceFactory::~InstantServiceFactory() { | 27 InstantServiceFactory::~InstantServiceFactory() { |
33 } | 28 } |
34 | 29 |
35 bool InstantServiceFactory::ServiceRedirectedInIncognito() const { | 30 bool InstantServiceFactory::ServiceRedirectedInIncognito() const { |
36 return true; | 31 return true; |
37 } | 32 } |
38 | 33 |
39 bool InstantServiceFactory::ServiceIsNULLWhileTesting() const { | 34 bool InstantServiceFactory::ServiceIsNULLWhileTesting() const { |
40 return true; | 35 return true; |
41 } | 36 } |
42 | 37 |
43 ProfileKeyedService* InstantServiceFactory::BuildServiceInstanceFor( | 38 ProfileKeyedService* InstantServiceFactory::BuildServiceInstanceFor( |
44 Profile* profile) const { | 39 Profile* profile) const { |
45 return BuildInstanceFor(profile); | 40 return new InstantService; |
46 } | 41 } |
OLD | NEW |