| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/webdata_services/web_data_service_wrapper.h" | 5 #include "components/webdata_services/web_data_service_wrapper.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" | 
|  | 10 #include "base/memory/ptr_util.h" | 
| 10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" | 
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" | 
| 12 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
     .h" | 13 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
     .h" | 
| 13 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
     vice.h" | 14 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
     vice.h" | 
| 14 #include "components/autofill/core/browser/webdata/autofill_table.h" | 15 #include "components/autofill/core/browser/webdata/autofill_table.h" | 
| 15 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
     able_service.h" | 16 #include "components/autofill/core/browser/webdata/autofill_wallet_metadata_sync
     able_service.h" | 
| 16 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
     ice.h" | 17 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
     ice.h" | 
| 17 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 18 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 
| 18 #include "components/password_manager/core/browser/webdata/logins_table.h" | 19 #include "components/password_manager/core/browser/webdata/logins_table.h" | 
| 19 #include "components/search_engines/keyword_table.h" | 20 #include "components/search_engines/keyword_table.h" | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 69     const std::string& application_locale, | 70     const std::string& application_locale, | 
| 70     const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 71     const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, | 
| 71     const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 72     const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, | 
| 72     const syncer::SyncableService::StartSyncFlare& flare, | 73     const syncer::SyncableService::StartSyncFlare& flare, | 
| 73     const ShowErrorCallback& show_error_callback) { | 74     const ShowErrorCallback& show_error_callback) { | 
| 74   base::FilePath path = context_path.Append(kWebDataFilename); | 75   base::FilePath path = context_path.Append(kWebDataFilename); | 
| 75   web_database_ = new WebDatabaseService(path, ui_thread, db_thread); | 76   web_database_ = new WebDatabaseService(path, ui_thread, db_thread); | 
| 76 | 77 | 
| 77   // All tables objects that participate in managing the database must | 78   // All tables objects that participate in managing the database must | 
| 78   // be added here. | 79   // be added here. | 
| 79   web_database_->AddTable(make_scoped_ptr(new autofill::AutofillTable)); | 80   web_database_->AddTable(base::WrapUnique(new autofill::AutofillTable)); | 
| 80   web_database_->AddTable(make_scoped_ptr(new KeywordTable)); | 81   web_database_->AddTable(base::WrapUnique(new KeywordTable)); | 
| 81   // TODO(mdm): We only really need the LoginsTable on Windows for IE7 password | 82   // TODO(mdm): We only really need the LoginsTable on Windows for IE7 password | 
| 82   // access, but for now, we still create it on all platforms since it deletes | 83   // access, but for now, we still create it on all platforms since it deletes | 
| 83   // the old logins table. We can remove this after a while, e.g. in M22 or so. | 84   // the old logins table. We can remove this after a while, e.g. in M22 or so. | 
| 84   web_database_->AddTable(make_scoped_ptr(new LoginsTable)); | 85   web_database_->AddTable(base::WrapUnique(new LoginsTable)); | 
| 85   web_database_->AddTable(make_scoped_ptr(new TokenServiceTable)); | 86   web_database_->AddTable(base::WrapUnique(new TokenServiceTable)); | 
| 86   web_database_->LoadDatabase(); | 87   web_database_->LoadDatabase(); | 
| 87 | 88 | 
| 88   autofill_web_data_ = new autofill::AutofillWebDataService( | 89   autofill_web_data_ = new autofill::AutofillWebDataService( | 
| 89       web_database_, ui_thread, db_thread, | 90       web_database_, ui_thread, db_thread, | 
| 90       base::Bind(show_error_callback, ERROR_LOADING_AUTOFILL)); | 91       base::Bind(show_error_callback, ERROR_LOADING_AUTOFILL)); | 
| 91   autofill_web_data_->Init(); | 92   autofill_web_data_->Init(); | 
| 92 | 93 | 
| 93   keyword_web_data_ = new KeywordWebDataService( | 94   keyword_web_data_ = new KeywordWebDataService( | 
| 94       web_database_, ui_thread, | 95       web_database_, ui_thread, | 
| 95       base::Bind(show_error_callback, ERROR_LOADING_KEYWORD)); | 96       base::Bind(show_error_callback, ERROR_LOADING_KEYWORD)); | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 140 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { | 141 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { | 
| 141   return token_web_data_.get(); | 142   return token_web_data_.get(); | 
| 142 } | 143 } | 
| 143 | 144 | 
| 144 #if defined(OS_WIN) | 145 #if defined(OS_WIN) | 
| 145 scoped_refptr<PasswordWebDataService> | 146 scoped_refptr<PasswordWebDataService> | 
| 146 WebDataServiceWrapper::GetPasswordWebData() { | 147 WebDataServiceWrapper::GetPasswordWebData() { | 
| 147   return password_web_data_.get(); | 148   return password_web_data_.get(); | 
| 148 } | 149 } | 
| 149 #endif | 150 #endif | 
| OLD | NEW | 
|---|