| 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/message_loop/message_loop_proxy.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" | 11 #include "components/autofill/core/browser/webdata/autocomplete_syncable_service
.h" |
| 12 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" | 12 #include "components/autofill/core/browser/webdata/autofill_profile_syncable_ser
vice.h" |
| 13 #include "components/autofill/core/browser/webdata/autofill_table.h" | 13 #include "components/autofill/core/browser/webdata/autofill_table.h" |
| 14 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.h" | 14 #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_serv
ice.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/password_manager/core/browser/webdata/logins_table.h" | 16 #include "components/password_manager/core/browser/webdata/logins_table.h" |
| 17 #include "components/search_engines/keyword_table.h" | 17 #include "components/search_engines/keyword_table.h" |
| 18 #include "components/search_engines/keyword_web_data_service.h" | 18 #include "components/search_engines/keyword_web_data_service.h" |
| 19 #include "components/signin/core/browser/webdata/token_service_table.h" | 19 #include "components/signin/core/browser/webdata/token_service_table.h" |
| 20 #include "components/signin/core/browser/webdata/token_web_data.h" | 20 #include "components/signin/core/browser/webdata/token_web_data.h" |
| 21 #include "components/webdata/common/web_database_service.h" | 21 #include "components/webdata/common/web_database_service.h" |
| 22 #include "components/webdata/common/webdata_constants.h" | 22 #include "components/webdata/common/webdata_constants.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" | 25 #include "components/password_manager/core/browser/webdata/password_web_data_ser
vice_win.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 void InitSyncableServicesOnDBThread( | 30 void InitSyncableServicesOnDBThread( |
| 31 const scoped_refptr<base::MessageLoopProxy>& db_thread, | 31 scoped_refptr<base::SingleThreadTaskRunner> db_thread, |
| 32 const syncer::SyncableService::StartSyncFlare& sync_flare, | 32 const syncer::SyncableService::StartSyncFlare& sync_flare, |
| 33 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, | 33 const scoped_refptr<autofill::AutofillWebDataService>& autofill_web_data, |
| 34 const base::FilePath& context_path, | 34 const base::FilePath& context_path, |
| 35 const std::string& app_locale, | 35 const std::string& app_locale, |
| 36 autofill::AutofillWebDataBackend* autofill_backend) { | 36 autofill::AutofillWebDataBackend* autofill_backend) { |
| 37 DCHECK(db_thread->BelongsToCurrentThread()); | 37 DCHECK(db_thread->BelongsToCurrentThread()); |
| 38 | 38 |
| 39 // Currently only Autocomplete and Autofill profiles use the new Sync API, but | 39 // Currently only Autocomplete and Autofill profiles use the new Sync API, but |
| 40 // all the database data should migrate to this API over time. | 40 // all the database data should migrate to this API over time. |
| 41 autofill::AutocompleteSyncableService::CreateForWebDataServiceAndBackend( | 41 autofill::AutocompleteSyncableService::CreateForWebDataServiceAndBackend( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 WebDataServiceWrapper::WebDataServiceWrapper() { | 59 WebDataServiceWrapper::WebDataServiceWrapper() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 WebDataServiceWrapper::WebDataServiceWrapper( | 62 WebDataServiceWrapper::WebDataServiceWrapper( |
| 63 const base::FilePath& context_path, | 63 const base::FilePath& context_path, |
| 64 const std::string& application_locale, | 64 const std::string& application_locale, |
| 65 const scoped_refptr<base::MessageLoopProxy>& ui_thread, | 65 const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
| 66 const scoped_refptr<base::MessageLoopProxy>& db_thread, | 66 const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
| 67 const syncer::SyncableService::StartSyncFlare& flare, | 67 const syncer::SyncableService::StartSyncFlare& flare, |
| 68 ShowErrorCallback show_error_callback) { | 68 ShowErrorCallback show_error_callback) { |
| 69 base::FilePath path = context_path.Append(kWebDataFilename); | 69 base::FilePath path = context_path.Append(kWebDataFilename); |
| 70 web_database_ = new WebDatabaseService(path, ui_thread, db_thread); | 70 web_database_ = new WebDatabaseService(path, ui_thread, db_thread); |
| 71 | 71 |
| 72 // All tables objects that participate in managing the database must | 72 // All tables objects that participate in managing the database must |
| 73 // be added here. | 73 // be added here. |
| 74 web_database_->AddTable(scoped_ptr<WebDatabaseTable>( | 74 web_database_->AddTable(scoped_ptr<WebDatabaseTable>( |
| 75 new autofill::AutofillTable(application_locale))); | 75 new autofill::AutofillTable(application_locale))); |
| 76 web_database_->AddTable(scoped_ptr<WebDatabaseTable>(new KeywordTable())); | 76 web_database_->AddTable(scoped_ptr<WebDatabaseTable>(new KeywordTable())); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { | 137 scoped_refptr<TokenWebData> WebDataServiceWrapper::GetTokenWebData() { |
| 138 return token_web_data_.get(); | 138 return token_web_data_.get(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 #if defined(OS_WIN) | 141 #if defined(OS_WIN) |
| 142 scoped_refptr<PasswordWebDataService> | 142 scoped_refptr<PasswordWebDataService> |
| 143 WebDataServiceWrapper::GetPasswordWebData() { | 143 WebDataServiceWrapper::GetPasswordWebData() { |
| 144 return password_web_data_.get(); | 144 return password_web_data_.get(); |
| 145 } | 145 } |
| 146 #endif | 146 #endif |
| OLD | NEW |