| 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/autofill/autocheckout_whitelist_manager_factory.h" | 5 #include "chrome/browser/autofill/autocheckout_whitelist_manager_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 WhitelistManager* | 44 WhitelistManager* |
| 45 WhitelistManagerServiceImpl::GetWhitelistManager() { | 45 WhitelistManagerServiceImpl::GetWhitelistManager() { |
| 46 return whitelist_manager_.get(); | 46 return whitelist_manager_.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 WhitelistManager* | 50 WhitelistManager* |
| 51 WhitelistManagerFactory::GetForProfile(Profile* profile) { | 51 WhitelistManagerFactory::GetForProfile(Profile* profile) { |
| 52 WhitelistManagerService* service = | 52 WhitelistManagerService* service = |
| 53 static_cast<WhitelistManagerService*>( | 53 static_cast<WhitelistManagerService*>( |
| 54 GetInstance()->GetServiceForProfile(profile, true)); | 54 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 55 // service can be NULL for tests. | 55 // service can be NULL for tests. |
| 56 return service ? service->GetWhitelistManager() : NULL; | 56 return service ? service->GetWhitelistManager() : NULL; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 WhitelistManagerFactory* | 60 WhitelistManagerFactory* |
| 61 WhitelistManagerFactory::GetInstance() { | 61 WhitelistManagerFactory::GetInstance() { |
| 62 return Singleton<WhitelistManagerFactory>::get(); | 62 return Singleton<WhitelistManagerFactory>::get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 WhitelistManagerFactory::WhitelistManagerFactory() | 65 WhitelistManagerFactory::WhitelistManagerFactory() |
| 66 : ProfileKeyedServiceFactory("AutocheckoutWhitelistManager", | 66 : BrowserContextKeyedServiceFactory("AutocheckoutWhitelistManager", |
| 67 ProfileDependencyManager::GetInstance()) { | 67 BrowserContextDependencyManager::GetInstance())
{ |
| 68 } | 68 } |
| 69 | 69 |
| 70 WhitelistManagerFactory::~WhitelistManagerFactory() { | 70 WhitelistManagerFactory::~WhitelistManagerFactory() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 ProfileKeyedService* | 73 BrowserContextKeyedService* |
| 74 WhitelistManagerFactory::BuildServiceInstanceFor( | 74 WhitelistManagerFactory::BuildServiceInstanceFor( |
| 75 content::BrowserContext* profile) const { | 75 content::BrowserContext* profile) const { |
| 76 WhitelistManagerService* service = | 76 WhitelistManagerService* service = |
| 77 new WhitelistManagerServiceImpl(static_cast<Profile*>(profile)); | 77 new WhitelistManagerServiceImpl(static_cast<Profile*>(profile)); |
| 78 return service; | 78 return service; |
| 79 } | 79 } |
| 80 | 80 |
| 81 content::BrowserContext* WhitelistManagerFactory::GetBrowserContextToUse( | 81 content::BrowserContext* WhitelistManagerFactory::GetBrowserContextToUse( |
| 82 content::BrowserContext* context) const { | 82 content::BrowserContext* context) const { |
| 83 return chrome::GetBrowserContextRedirectedInIncognito(context); | 83 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool WhitelistManagerFactory::ServiceIsNULLWhileTesting() const { | 86 bool WhitelistManagerFactory::ServiceIsNULLWhileTesting() const { |
| 87 return true; | 87 return true; |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace autocheckout | 90 } // namespace autocheckout |
| 91 } // namespace autofill | 91 } // namespace autofill |
| OLD | NEW |