| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/favicon/favicon_service.h" |
| 9 #include "chrome/browser/history/history_service_factory.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 12 #include "chrome/common/pref_names.h" |
| 13 |
| 14 // static |
| 15 FaviconService* FaviconServiceFactory::GetForProfile( |
| 16 Profile* profile, Profile::ServiceAccessType sat) { |
| 17 if (!profile->IsOffTheRecord()) { |
| 18 return static_cast<FaviconService*>( |
| 19 GetInstance()->GetServiceForProfile(profile, true)); |
| 20 } else if (sat == Profile::EXPLICIT_ACCESS) { |
| 21 // Profile must be OffTheRecord in this case. |
| 22 return static_cast<FaviconService*>( |
| 23 GetInstance()->GetServiceForProfile( |
| 24 profile->GetOriginalProfile(), true)); |
| 25 } |
| 26 |
| 27 // Profile is OffTheRecord without access. |
| 28 NOTREACHED() << "This profile is OffTheRecord"; |
| 29 return NULL; |
| 30 } |
| 31 |
| 32 // static |
| 33 FaviconServiceFactory* FaviconServiceFactory::GetInstance() { |
| 34 return Singleton<FaviconServiceFactory>::get(); |
| 35 } |
| 36 |
| 37 FaviconServiceFactory::FaviconServiceFactory() |
| 38 : ProfileKeyedServiceFactory("FaviconService", |
| 39 ProfileDependencyManager::GetInstance()) { |
| 40 DependsOn(HistoryServiceFactory::GetInstance()); |
| 41 } |
| 42 |
| 43 FaviconServiceFactory::~FaviconServiceFactory() {} |
| 44 |
| 45 ProfileKeyedService* FaviconServiceFactory::BuildServiceInstanceFor( |
| 46 Profile* profile) const { |
| 47 return new FaviconService(profile); |
| 48 } |
| 49 |
| 50 bool FaviconServiceFactory::ServiceIsNULLWhileTesting() { |
| 51 return true; |
| 52 } |
| OLD | NEW |