| 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/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.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" |
| 11 #include "chrome/browser/signin/account_tracker_service_factory.h" | 11 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 12 #include "chrome/browser/signin/signin_manager_factory.h" | 12 #include "chrome/browser/signin/signin_manager_factory.h" |
| 13 #include "chrome/browser/web_data_service_factory.h" | 13 #include "chrome/browser/web_data_service_factory.h" |
| 14 #include "components/autofill/core/browser/personal_data_manager.h" | 14 #include "components/autofill/core/browser/personal_data_manager.h" |
| 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 15 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 17 #include "components/signin/core/browser/account_tracker_service.h" | 17 #include "components/signin/core/browser/account_tracker_service.h" |
| 18 #include "components/signin/core/browser/signin_manager.h" | 18 #include "components/signin/core/browser/signin_manager.h" |
| 19 #include "content/public/browser/storage_partition.h" |
| 19 | 20 |
| 20 namespace autofill { | 21 namespace autofill { |
| 21 | 22 |
| 22 // static | 23 // static |
| 23 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( | 24 PersonalDataManager* PersonalDataManagerFactory::GetForProfile( |
| 24 Profile* profile) { | 25 Profile* profile) { |
| 25 return static_cast<PersonalDataManager*>( | 26 return static_cast<PersonalDataManager*>( |
| 26 GetInstance()->GetServiceForBrowserContext(profile, true)); | 27 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 DependsOn(SigninManagerFactory::GetInstance()); | 40 DependsOn(SigninManagerFactory::GetInstance()); |
| 40 DependsOn(WebDataServiceFactory::GetInstance()); | 41 DependsOn(WebDataServiceFactory::GetInstance()); |
| 41 } | 42 } |
| 42 | 43 |
| 43 PersonalDataManagerFactory::~PersonalDataManagerFactory() { | 44 PersonalDataManagerFactory::~PersonalDataManagerFactory() { |
| 44 } | 45 } |
| 45 | 46 |
| 46 KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( | 47 KeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( |
| 47 content::BrowserContext* context) const { | 48 content::BrowserContext* context) const { |
| 48 Profile* profile = Profile::FromBrowserContext(context); | 49 Profile* profile = Profile::FromBrowserContext(context); |
| 49 PersonalDataManager* service = | 50 PersonalDataManager* service = new PersonalDataManager( |
| 50 new PersonalDataManager(g_browser_process->GetApplicationLocale()); | 51 g_browser_process->GetApplicationLocale(), |
| 52 content::BrowserContext::GetDefaultStoragePartition(context) |
| 53 ->GetURLRequestContext()); |
| 51 service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile( | 54 service->Init(WebDataServiceFactory::GetAutofillWebDataForProfile( |
| 52 profile, ServiceAccessType::EXPLICIT_ACCESS), | 55 profile, ServiceAccessType::EXPLICIT_ACCESS), |
| 53 profile->GetPrefs(), | 56 profile->GetPrefs(), |
| 54 AccountTrackerServiceFactory::GetForProfile(profile), | 57 AccountTrackerServiceFactory::GetForProfile(profile), |
| 55 SigninManagerFactory::GetForProfile(profile), | 58 SigninManagerFactory::GetForProfile(profile), |
| 56 profile->IsOffTheRecord()); | 59 profile->IsOffTheRecord()); |
| 57 return service; | 60 return service; |
| 58 } | 61 } |
| 59 | 62 |
| 60 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse( | 63 content::BrowserContext* PersonalDataManagerFactory::GetBrowserContextToUse( |
| 61 content::BrowserContext* context) const { | 64 content::BrowserContext* context) const { |
| 62 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 65 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
| 63 } | 66 } |
| 64 | 67 |
| 65 } // namespace autofill | 68 } // namespace autofill |
| OLD | NEW |