| 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/search/instant_service_factory.h" | 5 #include "chrome/browser/search/instant_service_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/profiles/profile_dependency_manager.h" | 8 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 8 #include "chrome/browser/search/instant_service.h" | 9 #include "chrome/browser/search/instant_service.h" |
| 9 | 10 |
| 10 // static | 11 // static |
| 11 InstantService* InstantServiceFactory::GetForProfile(Profile* profile) { | 12 InstantService* InstantServiceFactory::GetForProfile(Profile* profile) { |
| 12 return static_cast<InstantService*>( | 13 return static_cast<InstantService*>( |
| 13 GetInstance()->GetServiceForProfile(profile, true)); | 14 GetInstance()->GetServiceForProfile(profile, true)); |
| 14 } | 15 } |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 InstantServiceFactory* InstantServiceFactory::GetInstance() { | 18 InstantServiceFactory* InstantServiceFactory::GetInstance() { |
| 18 return Singleton<InstantServiceFactory>::get(); | 19 return Singleton<InstantServiceFactory>::get(); |
| 19 } | 20 } |
| 20 | 21 |
| 21 InstantServiceFactory::InstantServiceFactory() | 22 InstantServiceFactory::InstantServiceFactory() |
| 22 : ProfileKeyedServiceFactory("InstantService", | 23 : ProfileKeyedServiceFactory("InstantService", |
| 23 ProfileDependencyManager::GetInstance()) { | 24 ProfileDependencyManager::GetInstance()) { |
| 24 // No dependencies. | 25 // No dependencies. |
| 25 } | 26 } |
| 26 | 27 |
| 27 InstantServiceFactory::~InstantServiceFactory() { | 28 InstantServiceFactory::~InstantServiceFactory() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool InstantServiceFactory::ServiceHasOwnInstanceInIncognito() const { | 31 bool InstantServiceFactory::ServiceHasOwnInstanceInIncognito() const { |
| 31 return true; | 32 return true; |
| 32 } | 33 } |
| 33 | 34 |
| 34 ProfileKeyedService* InstantServiceFactory::BuildServiceInstanceFor( | 35 ProfileKeyedService* InstantServiceFactory::BuildServiceInstanceFor( |
| 35 Profile* profile) const { | 36 content::BrowserContext* profile) const { |
| 36 return new InstantService(profile); | 37 return new InstantService(static_cast<Profile*>(profile)); |
| 37 } | 38 } |
| OLD | NEW |