| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/personal_data_manager_factory.h" | 5 #include "chrome/browser/autofill/personal_data_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/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return personal_data_manager_.get(); | 46 return personal_data_manager_.get(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( | 52 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( |
| 53 Profile* profile) { | 53 Profile* profile) { |
| 54 PersonalDataManagerService* service = | 54 PersonalDataManagerService* service = |
| 55 static_cast<PersonalDataManagerService*>( | 55 static_cast<PersonalDataManagerService*>( |
| 56 GetInstance()->GetServiceForProfile(profile, true)); | 56 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 57 | 57 |
| 58 if (service) | 58 if (service) |
| 59 return service->GetPersonalDataManager(); | 59 return service->GetPersonalDataManager(); |
| 60 | 60 |
| 61 // |service| can be NULL in Incognito mode. | 61 // |service| can be NULL in Incognito mode. |
| 62 return NULL; | 62 return NULL; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { | 66 PersonalDataManagerFactory* PersonalDataManagerFactory::GetInstance() { |
| 67 return Singleton<PersonalDataManagerFactory>::get(); | 67 return Singleton<PersonalDataManagerFactory>::get(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 PersonalDataManagerFactory::PersonalDataManagerFactory() | 70 PersonalDataManagerFactory::PersonalDataManagerFactory() |
| 71 : ProfileKeyedServiceFactory("PersonalDataManager", | 71 : BrowserContextKeyedServiceFactory("PersonalDataManager", |
| 72 ProfileDependencyManager::GetInstance()) { | 72 BrowserContextDependencyManager::GetInstance())
{ |
| 73 DependsOn(WebDataServiceFactory::GetInstance()); | 73 DependsOn(WebDataServiceFactory::GetInstance()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 PersonalDataManagerFactory::~PersonalDataManagerFactory() { | 76 PersonalDataManagerFactory::~PersonalDataManagerFactory() { |
| 77 } | 77 } |
| 78 | 78 |
| 79 ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( | 79 BrowserContextKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( |
| 80 content::BrowserContext* profile) const { | 80 content::BrowserContext* profile) const { |
| 81 PersonalDataManagerService* service = | 81 PersonalDataManagerService* service = |
| 82 new PersonalDataManagerServiceImpl(static_cast<Profile*>(profile)); | 82 new PersonalDataManagerServiceImpl(static_cast<Profile*>(profile)); |
| 83 return service; | 83 return service; |
| 84 } | 84 } |
| 85 | 85 |
| 86 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse( | 86 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse( |
| 87 content::BrowserContext* context) const { | 87 content::BrowserContext* context) const { |
| 88 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 88 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace autofill | 91 } // namespace autofill |
| OLD | NEW |