| 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/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
| 12 #include "chrome/browser/webdata/web_data_service_factory.h" | 12 #include "chrome/browser/webdata/web_data_service_factory.h" |
| 13 #include "components/autofill/browser/personal_data_manager.h" | 13 #include "components/autofill/browser/personal_data_manager.h" |
| 14 #include "components/autofill/browser/webdata/autofill_webdata_service.h" |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 namespace { | 17 namespace { |
| 17 | 18 |
| 18 class PersonalDataManagerServiceImpl : public PersonalDataManagerService { | 19 class PersonalDataManagerServiceImpl : public PersonalDataManagerService { |
| 19 public: | 20 public: |
| 20 explicit PersonalDataManagerServiceImpl(Profile* profile); | 21 explicit PersonalDataManagerServiceImpl(Profile* profile); |
| 21 virtual ~PersonalDataManagerServiceImpl(); | 22 virtual ~PersonalDataManagerServiceImpl(); |
| 22 | 23 |
| 23 // PersonalDataManagerService: | 24 // PersonalDataManagerService: |
| 24 virtual void Shutdown() OVERRIDE; | 25 virtual void Shutdown() OVERRIDE; |
| 25 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; | 26 virtual PersonalDataManager* GetPersonalDataManager() OVERRIDE; |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 scoped_ptr<PersonalDataManager> personal_data_manager_; | 29 scoped_ptr<PersonalDataManager> personal_data_manager_; |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 PersonalDataManagerServiceImpl::PersonalDataManagerServiceImpl( | 32 PersonalDataManagerServiceImpl::PersonalDataManagerServiceImpl( |
| 32 Profile* profile) { | 33 Profile* profile) { |
| 33 personal_data_manager_.reset(new PersonalDataManager( | 34 personal_data_manager_.reset(new PersonalDataManager( |
| 34 g_browser_process->GetApplicationLocale())); | 35 g_browser_process->GetApplicationLocale())); |
| 35 personal_data_manager_->Init(profile); | 36 personal_data_manager_->Init( |
| 37 profile, |
| 38 WebDataServiceFactory::GetAutofillWebDataServiceForProfile(profile)); |
| 36 } | 39 } |
| 37 | 40 |
| 38 PersonalDataManagerServiceImpl::~PersonalDataManagerServiceImpl() {} | 41 PersonalDataManagerServiceImpl::~PersonalDataManagerServiceImpl() {} |
| 39 | 42 |
| 40 void PersonalDataManagerServiceImpl::Shutdown() { | 43 void PersonalDataManagerServiceImpl::Shutdown() { |
| 41 personal_data_manager_.reset(); | 44 personal_data_manager_.reset(); |
| 42 } | 45 } |
| 43 | 46 |
| 44 PersonalDataManager* PersonalDataManagerServiceImpl::GetPersonalDataManager() { | 47 PersonalDataManager* PersonalDataManagerServiceImpl::GetPersonalDataManager() { |
| 45 return personal_data_manager_.get(); | 48 return personal_data_manager_.get(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 76 } | 79 } |
| 77 | 80 |
| 78 ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( | 81 ProfileKeyedService* PersonalDataManagerFactory::BuildServiceInstanceFor( |
| 79 Profile* profile) const { | 82 Profile* profile) const { |
| 80 PersonalDataManagerService* service = | 83 PersonalDataManagerService* service = |
| 81 new PersonalDataManagerServiceImpl(profile); | 84 new PersonalDataManagerServiceImpl(profile); |
| 82 return service; | 85 return service; |
| 83 } | 86 } |
| 84 | 87 |
| 85 } // namespace autofill | 88 } // namespace autofill |
| OLD | NEW |